undefect. CWE-407 — 63 sites patched across 27 ecosystems

Authors: russell@unturf.com · brackishbert@gmail.com · foxhop.net · TimeHexOn.com

Patches, unit tests, benchmarks, whitepaper, and outreach briefs.
Public domain — no copyright claimed. Use freely.
This commit is contained in:
russell@unturf.com 2026-03-26 17:11:57 -04:00
commit 0a580b313d
70422 changed files with 17213626 additions and 0 deletions

View file

@ -0,0 +1,2 @@
public class FirstBean {
}

View file

@ -0,0 +1,4 @@
import java.beans.PropertyEditorSupport;
public class FirstBeanEditor extends PropertyEditorSupport {
}

View file

@ -0,0 +1,2 @@
public class SecondBean {
}

View file

@ -0,0 +1,137 @@
/*
* Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6380849
* @summary Tests PropertyEditor finder
* @author Sergey Malenkov
* @modules java.desktop/com.sun.beans.editors
* @compile -XDignore.symbol.file TestPropertyEditor.java
* @run main TestPropertyEditor
* @key headful
*/
import editors.SecondBeanEditor;
import editors.ThirdBeanEditor;
import java.awt.Color;
import java.awt.Font;
import java.beans.PropertyEditor;
import java.beans.PropertyEditorManager;
import com.sun.beans.editors.BooleanEditor;
import com.sun.beans.editors.ByteEditor;
import com.sun.beans.editors.ColorEditor;
import com.sun.beans.editors.DoubleEditor;
import com.sun.beans.editors.EnumEditor;
import com.sun.beans.editors.FloatEditor;
import com.sun.beans.editors.FontEditor;
import com.sun.beans.editors.IntegerEditor;
import com.sun.beans.editors.LongEditor;
import com.sun.beans.editors.ShortEditor;
import com.sun.beans.editors.StringEditor;
public class TestPropertyEditor implements Runnable {
private enum Enumeration {
FIRST, SECOND, THIRD
}
private static final String[] SEARCH_PATH = { "editors" }; // NON-NLS: package name
public static void main(String[] args) throws InterruptedException {
TestPropertyEditor test = new TestPropertyEditor();
test.run();
// the following tests fails on previous build
ThreadGroup group = new ThreadGroup("$$$"); // NON-NLS: unique thread name
Thread thread = new Thread(group, test);
thread.start();
thread.join();
}
private static void test(Class<?> type, Class<? extends PropertyEditor> expected) {
PropertyEditor actual = PropertyEditorManager.findEditor(type);
if ((actual == null) && (expected != null)) {
throw new Error("expected editor is not found");
}
if ((actual != null) && !actual.getClass().equals(expected)) {
throw new Error("found unexpected editor");
}
}
public void run() {
PropertyEditorManager.registerEditor(ThirdBean.class, ThirdBeanEditor.class);
test(FirstBean.class, FirstBeanEditor.class);
test(SecondBean.class, null);
test(ThirdBean.class, ThirdBeanEditor.class);
// test editors for default primitive types
test(Byte.TYPE, ByteEditor.class);
test(Short.TYPE, ShortEditor.class);
test(Integer.TYPE, IntegerEditor.class);
test(Long.TYPE, LongEditor.class);
test(Boolean.TYPE, BooleanEditor.class);
test(Float.TYPE, FloatEditor.class);
test(Double.TYPE, DoubleEditor.class);
// test editors for default object types
test(Byte.class, ByteEditor.class);
test(Short.class, ShortEditor.class);
test(Integer.class, IntegerEditor.class);
test(Long.class, LongEditor.class);
test(Boolean.class, BooleanEditor.class);
test(Float.class, FloatEditor.class);
test(Double.class, DoubleEditor.class);
test(String.class, StringEditor.class);
test(Color.class, ColorEditor.class);
test(Font.class, FontEditor.class);
test(Enumeration.class, EnumEditor.class);
PropertyEditorManager.registerEditor(ThirdBean.class, null);
PropertyEditorManager.setEditorSearchPath(SEARCH_PATH);
test(FirstBean.class, FirstBeanEditor.class);
test(SecondBean.class, SecondBeanEditor.class);
test(ThirdBean.class, ThirdBeanEditor.class);
// test editors for default primitive types
test(Byte.TYPE, ByteEditor.class);
test(Short.TYPE, ShortEditor.class);
test(Integer.TYPE, IntegerEditor.class);
test(Long.TYPE, LongEditor.class);
test(Boolean.TYPE, BooleanEditor.class);
test(Float.TYPE, FloatEditor.class);
test(Double.TYPE, DoubleEditor.class);
// test editors for default object types
test(Byte.class, null);
test(Short.class, null);
test(Integer.class, null);
test(Long.class, null);
test(Boolean.class, null);
test(Float.class, null);
test(Double.class, null);
test(String.class, null);
test(Color.class, null);
test(Font.class, null);
test(Enumeration.class, EnumEditor.class);
}
}

View file

@ -0,0 +1,2 @@
public class ThirdBean {
}

View file

@ -0,0 +1,6 @@
package editors;
import java.beans.PropertyEditorSupport;
public class SecondBeanEditor extends PropertyEditorSupport {
}

View file

@ -0,0 +1,6 @@
package editors;
import java.beans.PropertyEditorSupport;
public class ThirdBeanEditor extends PropertyEditorSupport {
}

View file

@ -0,0 +1,143 @@
/*
* Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
import java.io.ByteArrayOutputStream;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.tools.FileObject;
import javax.tools.ForwardingJavaFileManager;
import javax.tools.JavaCompiler;
import javax.tools.JavaFileManager;
import javax.tools.JavaFileObject.Kind;
import javax.tools.SimpleJavaFileObject;
import javax.tools.ToolProvider;
public final class MemoryClassLoader extends ClassLoader {
private final JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
private final MemoryFileManager manager = new MemoryFileManager(this.compiler);
public Class<?> compile(String name, String content) {
compile(new Source(name, content));
try {
return findClass(name);
}
catch (ClassNotFoundException exception) {
throw new Error(exception);
}
}
public void compile(Source... sources) {
List<Source> list = new ArrayList<Source>();
if (sources != null) {
for (Source source : sources) {
if (source != null) {
list.add(source);
}
}
}
synchronized (this.manager) {
this.compiler.getTask(null, this.manager, null, null, null, list).call();
}
}
@Override
protected Class<?> findClass(String name) throws ClassNotFoundException {
synchronized (this.manager) {
Output mc = this.manager.map.remove(name);
if (mc != null) {
byte[] array = mc.toByteArray();
return defineClass(name, array, 0, array.length);
}
}
return super.findClass(name);
}
private static final class MemoryFileManager extends ForwardingJavaFileManager<JavaFileManager> {
private final Map<String, Output> map = new HashMap<String, Output>();
MemoryFileManager(JavaCompiler compiler) {
super(compiler.getStandardFileManager(null, null, null));
}
@Override
public Output getJavaFileForOutput(Location location, String name, Kind kind, FileObject source) {
Output mc = this.map.get(name);
if (mc == null) {
mc = new Output(name);
this.map.put(name, mc);
}
return mc;
}
}
private static class MemoryFileObject extends SimpleJavaFileObject {
MemoryFileObject(String name, Kind kind) {
super(toURI(name, kind.extension), kind);
}
private static URI toURI(String name, String extension) {
try {
return new URI("mfm:///" + name.replace('.', '/') + extension);
}
catch (URISyntaxException exception) {
throw new Error(exception);
}
}
}
private static final class Output extends MemoryFileObject {
private final ByteArrayOutputStream baos = new ByteArrayOutputStream();
Output(String name) {
super(name, Kind.CLASS);
}
byte[] toByteArray() {
return this.baos.toByteArray();
}
@Override
public ByteArrayOutputStream openOutputStream() {
this.baos.reset();
return this.baos;
}
}
public static final class Source extends MemoryFileObject {
private final String content;
Source(String name, String content) {
super(name, Kind.SOURCE);
this.content = content;
}
@Override
public CharSequence getCharContent(boolean ignore) {
return this.content;
}
}
}

View file

@ -0,0 +1,45 @@
/*
* Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4968709
* @summary Tests PropertyEditor after changing EditorSearchPath
* @author Brent Christian
*/
import java.beans.PropertyEditorManager;
public class Test4968709 {
public static void main(String[] args) {
String[] oldPath = PropertyEditorManager.getEditorSearchPath();
String[] newPath = {"aaa.bbb", "aaa.ccc",};
PropertyEditorManager.setEditorSearchPath(newPath);
if (null != PropertyEditorManager.findEditor(Test4968709.class))
throw new Error("found unexpected editor");
PropertyEditorManager.setEditorSearchPath(oldPath);
if (null == PropertyEditorManager.findEditor(Double.TYPE))
throw new Error("expected editor is not found");
}
}

View file

@ -0,0 +1,69 @@
/*
* Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6397609
* @summary Tests autocleaning
* @author Sergey Malenkov
* @modules java.compiler
* java.desktop
* jdk.compiler
*/
import java.beans.PropertyEditorManager;
import java.lang.ref.WeakReference;
public class Test6397609 {
public static void main(String[] args) throws Exception {
Class<?> targetClass = Object.class;
Class<?> editorClass = new MemoryClassLoader().compile("Editor",
"public class Editor extends java.beans.PropertyEditorSupport {}");
PropertyEditorManager.registerEditor(targetClass, editorClass);
// trigger a gc
Object object = new Object();
var r = new WeakReference<Object>(object);
object = null;
while (r.get() != null) {
System.gc();
Thread.sleep(100);
}
if (PropertyEditorManager.findEditor(targetClass) == null) {
throw new Error("the editor is lost");
}
// allow, and wait for, Editor class to be unloaded
var ref = new WeakReference<Class<?>>(editorClass);
editorClass = null;
while (ref.get() != null) {
System.gc();
Thread.sleep(100);
}
if (PropertyEditorManager.findEditor(targetClass) != null) {
throw new Error("unexpected editor is found");
}
}
}

View file

@ -0,0 +1,86 @@
/*
* Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6963811
* @summary Tests deadlock in PropertyEditorManager
* @author Sergey Malenkov
* @modules java.desktop/com.sun.beans.editors
* @compile -XDignore.symbol.file Test6963811.java
* @run main Test6963811
*/
import java.beans.PropertyEditorManager;
import com.sun.beans.editors.StringEditor;
public class Test6963811 implements Runnable {
private final long time;
private final boolean sync;
public Test6963811(long time, boolean sync) {
this.time = time;
this.sync = sync;
}
public void run() {
try {
Thread.sleep(this.time); // increase the chance of the deadlock
if (this.sync) {
synchronized (Test6963811.class) {
PropertyEditorManager.findEditor(Super.class);
}
}
else {
PropertyEditorManager.findEditor(Sub.class);
}
}
catch (Exception exception) {
exception.printStackTrace();
}
}
public static void main(String[] args) throws Exception {
Thread[] threads = new Thread[2];
for (int i = 0; i < threads.length; i++) {
threads[i] = new Thread(new Test6963811(0L, i > 0));
threads[i].start();
Thread.sleep(500L); // increase the chance of the deadlock
}
for (Thread thread : threads) {
thread.join();
}
}
public static class Super {
}
public static class Sub extends Super {
}
public static class SubEditor extends StringEditor {
public SubEditor() {
new Test6963811(1000L, true).run();
}
}
}

View file

@ -0,0 +1,59 @@
/*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 7087876
* @summary Tests spec of the createPropertyEditor method
* @author Sergey Malenkov
*/
import java.beans.IntrospectionException;
import java.beans.PropertyDescriptor;
import java.beans.PropertyEditorSupport;
public class Test7087876 {
public static void main(String[] args) throws IntrospectionException {
PropertyDescriptor pd = new PropertyDescriptor("value", Bean.class);
pd.setPropertyEditorClass(Editor.class);
pd.createPropertyEditor(new Bean());
}
public static class Bean {
private String value;
public String getValue() {
return this.value;
}
public void setValue(String value) {
this.value = value;
}
}
public static class Editor extends PropertyEditorSupport {
private Editor() {
}
}
}

View file

@ -0,0 +1,38 @@
/*
* Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4506596 6498158
* @summary Tests PropertyEditor for value of type Boolean
* @author Sergey Malenkov
* @modules java.compiler
* java.desktop
* jdk.compiler
*/
public class TestBooleanClassJava {
public static void main(String[] args) {
new TestEditor(Boolean.class).testJava(Boolean.valueOf(true));
}
}

View file

@ -0,0 +1,38 @@
/*
* Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4506596 6498158 6498171
* @summary Tests PropertyEditor for null value of type Boolean
* @author Sergey Malenkov
* @modules java.compiler
* java.desktop
* jdk.compiler
*/
public class TestBooleanClassNull {
public static void main(String[] args) {
new TestEditor(Boolean.class).testJava(null);
}
}

View file

@ -0,0 +1,42 @@
/*
* Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4222827 4506596 6498158
* @summary Tests PropertyEditor for value of type Boolean
* @author Sergey Malenkov
* @modules java.compiler
* java.desktop
* jdk.compiler
*/
public class TestBooleanClassValue {
public static void main(String[] args) {
TestEditor test = new TestEditor(Boolean.class);
test.testValue(true, "True");
test.testValue(null, null);
test.testText("False", false);
test.testText(null, null);
}
}

View file

@ -0,0 +1,38 @@
/*
* Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4506596
* @summary Tests PropertyEditor for value of type boolean
* @author Sergey Malenkov
* @modules java.compiler
* java.desktop
* jdk.compiler
*/
public class TestBooleanTypeJava {
public static void main(String[] args) {
new TestEditor(Boolean.TYPE).testJava(Boolean.valueOf(true));
}
}

View file

@ -0,0 +1,38 @@
/*
* Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4506596 6498171
* @summary Tests PropertyEditor for null value of type boolean
* @author Sergey Malenkov
* @modules java.compiler
* java.desktop
* jdk.compiler
*/
public class TestBooleanTypeNull {
public static void main(String[] args) {
new TestEditor(Boolean.TYPE).testJava(null);
}
}

View file

@ -0,0 +1,42 @@
/*
* Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4222827 4506596
* @summary Tests PropertyEditor for value of type boolean
* @author Sergey Malenkov
* @modules java.compiler
* java.desktop
* jdk.compiler
*/
public class TestBooleanTypeValue {
public static void main(String[] args) {
TestEditor test = new TestEditor(Boolean.TYPE);
test.testValue(true, "True");
test.testValue(null, null);
test.testText("False", false);
test.testText(null, null);
}
}

View file

@ -0,0 +1,38 @@
/*
* Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4506596
* @summary Tests PropertyEditor for value of type Byte
* @author Sergey Malenkov
* @modules java.compiler
* java.desktop
* jdk.compiler
*/
public class TestByteClassJava {
public static void main(String[] args) {
new TestEditor(Byte.class).testJava(Byte.valueOf((byte) 12));
}
}

View file

@ -0,0 +1,38 @@
/*
* Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4506596 6498171
* @summary Tests PropertyEditor for null value of type Byte
* @author Sergey Malenkov
* @modules java.compiler
* java.desktop
* jdk.compiler
*/
public class TestByteClassNull {
public static void main(String[] args) {
new TestEditor(Byte.class).testJava(null);
}
}

View file

@ -0,0 +1,42 @@
/*
* Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4222827 4506596
* @summary Tests PropertyEditor for value of type Byte
* @author Sergey Malenkov
* @modules java.compiler
* java.desktop
* jdk.compiler
*/
public class TestByteClassValue {
public static void main(String[] args) {
TestEditor test = new TestEditor(Byte.class);
test.testValue((byte) 0, "0");
test.testValue(null, null);
test.testText("1", (byte) 1);
test.testText(null, null);
}
}

View file

@ -0,0 +1,38 @@
/*
* Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4506596
* @summary Tests PropertyEditor for value of type byte
* @author Sergey Malenkov
* @modules java.compiler
* java.desktop
* jdk.compiler
*/
public class TestByteTypeJava {
public static void main(String[] args) {
new TestEditor(Byte.TYPE).testJava(Byte.valueOf((byte) 12));
}
}

View file

@ -0,0 +1,38 @@
/*
* Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4506596 6498171
* @summary Tests PropertyEditor for null value of type byte
* @author Sergey Malenkov
* @modules java.compiler
* java.desktop
* jdk.compiler
*/
public class TestByteTypeNull {
public static void main(String[] args) {
new TestEditor(Byte.TYPE).testJava(null);
}
}

View file

@ -0,0 +1,42 @@
/*
* Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4222827 4506596
* @summary Tests PropertyEditor for value of type byte
* @author Sergey Malenkov
* @modules java.compiler
* java.desktop
* jdk.compiler
*/
public class TestByteTypeValue {
public static void main(String[] args) {
TestEditor test = new TestEditor(Byte.TYPE);
test.testValue((byte) 0, "0");
test.testValue(null, null);
test.testText("1", (byte) 1);
test.testText(null, null);
}
}

View file

@ -0,0 +1,41 @@
/*
* Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4506596
* @summary Tests PropertyEditor for value of type Color
* @author Sergey Malenkov
* @key headful
* @modules java.compiler
* java.desktop
* jdk.compiler
*/
import java.awt.Color;
public class TestColorClassJava {
public static void main(String[] args) {
new TestEditor(Color.class).testJava(Color.RED);
}
}

View file

@ -0,0 +1,41 @@
/*
* Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4506596 6498171
* @summary Tests PropertyEditor for null value of type Color
* @author Sergey Malenkov
* @key headful
* @modules java.compiler
* java.desktop
* jdk.compiler
*/
import java.awt.Color;
public class TestColorClassNull {
public static void main(String[] args) {
new TestEditor(Color.class).testJava(null);
}
}

View file

@ -0,0 +1,45 @@
/*
* Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4222827 4506596
* @summary Tests PropertyEditor for value of type Color
* @author Sergey Malenkov
* @key headful
* @modules java.compiler
* java.desktop
* jdk.compiler
*/
import java.awt.Color;
public class TestColorClassValue {
public static void main(String[] args) {
TestEditor test = new TestEditor(Color.class);
test.testValue(Color.GREEN, "0,255,0");
test.testValue(null, null);
test.testText("0,0,0", Color.BLACK);
test.testText(null, null);
}
}

View file

@ -0,0 +1,38 @@
/*
* Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4506596
* @summary Tests PropertyEditor for value of type Double
* @author Sergey Malenkov
* @modules java.compiler
* java.desktop
* jdk.compiler
*/
public class TestDoubleClassJava {
public static void main(String[] args) {
new TestEditor(Double.class).testJava(Double.valueOf(12.34));
}
}

View file

@ -0,0 +1,38 @@
/*
* Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4506596 6498171
* @summary Tests PropertyEditor for null value of type Double
* @author Sergey Malenkov
* @modules java.compiler
* java.desktop
* jdk.compiler
*/
public class TestDoubleClassNull {
public static void main(String[] args) {
new TestEditor(Double.class).testJava(null);
}
}

View file

@ -0,0 +1,42 @@
/*
* Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4222827 4506596
* @summary Tests PropertyEditor for value of type Double
* @author Sergey Malenkov
* @modules java.compiler
* java.desktop
* jdk.compiler
*/
public class TestDoubleClassValue {
public static void main(String[] args) {
TestEditor test = new TestEditor(Double.class);
test.testValue(0.0, "0.0");
test.testValue(null, null);
test.testText("1.1", 1.1);
test.testText(null, null);
}
}

View file

@ -0,0 +1,38 @@
/*
* Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4506596
* @summary Tests PropertyEditor for value of type double
* @author Sergey Malenkov
* @modules java.compiler
* java.desktop
* jdk.compiler
*/
public class TestDoubleTypeJava {
public static void main(String[] args) {
new TestEditor(Double.TYPE).testJava(Double.valueOf(12.34));
}
}

View file

@ -0,0 +1,38 @@
/*
* Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4506596 6498171
* @summary Tests PropertyEditor for null value of type double
* @author Sergey Malenkov
* @modules java.compiler
* java.desktop
* jdk.compiler
*/
public class TestDoubleTypeNull {
public static void main(String[] args) {
new TestEditor(Double.TYPE).testJava(null);
}
}

View file

@ -0,0 +1,42 @@
/*
* Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4222827 4506596
* @summary Tests PropertyEditor for value of type double
* @author Sergey Malenkov
* @modules java.compiler
* java.desktop
* jdk.compiler
*/
public class TestDoubleTypeValue {
public static void main(String[] args) {
TestEditor test = new TestEditor(Double.TYPE);
test.testValue(0.0, "0.0");
test.testValue(null, null);
test.testText("1.1", 1.1);
test.testText(null, null);
}
}

View file

@ -0,0 +1,94 @@
/*
* Copyright (c) 2006, 2008, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
import java.beans.PropertyEditor;
import java.beans.PropertyEditorManager;
final class TestEditor {
private final PropertyEditor editor;
TestEditor(Class type) {
System.out.println("Property class: " + type);
this.editor = PropertyEditorManager.findEditor(type);
if (this.editor == null)
throw new Error("could not find editor for " + type);
System.out.println("PropertyEditor class: " + this.editor.getClass());
validate(null, null);
}
void testJava(Object value) {
this.editor.setValue(value);
Object object = execute("Executor", "execute", this.editor.getJavaInitializationString());
System.out.println("Property value before: " + value);
System.out.println("Property value after: " + object);
if (!areEqual(value, object))
throw new Error("values are not equal");
}
void testValue(Object value, String text) {
this.editor.setValue(value);
validate(value, text);
}
void testText(String text, Object value) {
this.editor.setAsText(text);
validate(value, text);
}
private void validate(Object value, String text) {
if (!areEqual(value, this.editor.getValue()))
throw new Error("value should be " + value);
if (!areEqual(text, this.editor.getAsText()))
throw new Error("text should be " + text);
}
private static boolean areEqual(Object object1, Object object2) {
return (object1 == null)
? object2 == null
: object1.equals(object2);
}
private static Object execute(String classname, String methodname, String value) {
String content
= "public class " + classname + " {"
+ " public static Object " + methodname + "() throws Exception {"
+ " return " + value + ";"
+ " }"
+ "}";
try {
MemoryClassLoader loader = new MemoryClassLoader();
Class type = loader.compile(classname, content);
return type.getMethod(methodname).invoke(null);
}
catch (Exception exception) {
throw new Error(exception);
}
}
}

View file

@ -0,0 +1,40 @@
/*
* Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4506596 6219769
* @summary Tests PropertyEditor for value of type Enum
* @author Sergey Malenkov
* @modules java.compiler
* java.desktop
* jdk.compiler
*/
public class TestEnumClassJava {
public static void main(String[] args) {
new TestEditor(HexLetter.class).testJava(HexLetter.A);
}
public enum HexLetter {A,B,C,D,E,F}
}

View file

@ -0,0 +1,40 @@
/*
* Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4506596 6219769 6498171
* @summary Tests PropertyEditor for null value of type Enum
* @author Sergey Malenkov
* @modules java.compiler
* java.desktop
* jdk.compiler
*/
public class TestEnumClassNull {
public static void main(String[] args) {
new TestEditor(HexLetter.class).testJava(null);
}
public enum HexLetter {A,B,C,D,E,F}
}

View file

@ -0,0 +1,44 @@
/*
* Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4222827 4506596 6219769
* @summary Tests PropertyEditor for value of type Enum
* @author Sergey Malenkov
* @modules java.compiler
* java.desktop
* jdk.compiler
*/
public class TestEnumClassValue {
public static void main(String[] args) {
TestEditor test = new TestEditor(HexLetter.class);
test.testValue(HexLetter.A, "A");
test.testValue(null, null);
test.testText("F", HexLetter.F);
test.testText(null, null);
}
public enum HexLetter {A,B,C,D,E,F}
}

View file

@ -0,0 +1,52 @@
/*
* Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6736248
* @summary Tests PropertyEditor for value of subtype Enum
* @author Sergey Malenkov
* @modules java.compiler
* java.desktop
* jdk.compiler
*/
public class TestEnumSubclassJava {
public static void main(String[] args) {
new TestEditor(Operation.class).testJava(Operation.PLUS);
}
public enum Operation {
PLUS {
public int run(int i, int j) {
return i + j;
}
},
MINUS {
public int run(int i, int j) {
return i - j;
}
};
public abstract int run(int i, int j);
}
}

View file

@ -0,0 +1,52 @@
/*
* Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6736248
* @summary Tests PropertyEditor for null value of subtype Enum
* @author Sergey Malenkov
* @modules java.compiler
* java.desktop
* jdk.compiler
*/
public class TestEnumSubclassNull {
public static void main(String[] args) {
new TestEditor(Operation.class).testJava(null);
}
public enum Operation {
PLUS {
public int run(int i, int j) {
return i + j;
}
},
MINUS {
public int run(int i, int j) {
return i - j;
}
};
public abstract int run(int i, int j);
}
}

View file

@ -0,0 +1,56 @@
/*
* Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6736248
* @summary Tests PropertyEditor for value of subtype Enum
* @author Sergey Malenkov
* @modules java.compiler
* java.desktop
* jdk.compiler
*/
public class TestEnumSubclassValue {
public static void main(String[] args) {
TestEditor test = new TestEditor(Operation.class);
test.testValue(Operation.PLUS, "PLUS");
test.testValue(null, null);
test.testText("MINUS", Operation.MINUS);
test.testText(null, null);
}
public enum Operation {
PLUS {
public int run(int i, int j) {
return i + j;
}
},
MINUS {
public int run(int i, int j) {
return i - j;
}
};
public abstract int run(int i, int j);
}
}

View file

@ -0,0 +1,38 @@
/*
* Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4506596
* @summary Tests PropertyEditor for value of type Float
* @author Sergey Malenkov
* @modules java.compiler
* java.desktop
* jdk.compiler
*/
public class TestFloatClassJava {
public static void main(String[] args) {
new TestEditor(Float.class).testJava(Float.valueOf(12.34f));
}
}

View file

@ -0,0 +1,38 @@
/*
* Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4506596 6498171
* @summary Tests PropertyEditor for null value of type Float
* @author Sergey Malenkov
* @modules java.compiler
* java.desktop
* jdk.compiler
*/
public class TestFloatClassNull {
public static void main(String[] args) {
new TestEditor(Float.class).testJava(null);
}
}

View file

@ -0,0 +1,42 @@
/*
* Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4222827 4506596
* @summary Tests PropertyEditor for value of type Float
* @author Sergey Malenkov
* @modules java.compiler
* java.desktop
* jdk.compiler
*/
public class TestFloatClassValue {
public static void main(String[] args) {
TestEditor test = new TestEditor(Float.class);
test.testValue(0.0f, "0.0");
test.testValue(null, null);
test.testText("1.1", 1.1f);
test.testText(null, null);
}
}

View file

@ -0,0 +1,38 @@
/*
* Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4506596
* @summary Tests PropertyEditor for value of type float
* @author Sergey Malenkov
* @modules java.compiler
* java.desktop
* jdk.compiler
*/
public class TestFloatTypeJava {
public static void main(String[] args) {
new TestEditor(Float.TYPE).testJava(Float.valueOf(12.34f));
}
}

View file

@ -0,0 +1,38 @@
/*
* Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4506596 6498171
* @summary Tests PropertyEditor for null value of type float
* @author Sergey Malenkov
* @modules java.compiler
* java.desktop
* jdk.compiler
*/
public class TestFloatTypeNull {
public static void main(String[] args) {
new TestEditor(Float.TYPE).testJava(null);
}
}

View file

@ -0,0 +1,42 @@
/*
* Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4222827 4506596
* @summary Tests PropertyEditor for value of type float
* @author Sergey Malenkov
* @modules java.compiler
* java.desktop
* jdk.compiler
*/
public class TestFloatTypeValue {
public static void main(String[] args) {
TestEditor test = new TestEditor(Float.TYPE);
test.testValue(0.0f, "0.0");
test.testValue(null, null);
test.testText("1.1", 1.1f);
test.testText(null, null);
}
}

View file

@ -0,0 +1,41 @@
/*
* Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4506596 6538853
* @summary Tests PropertyEditor for value of type Font
* @author Sergey Malenkov
* @key headful
* @modules java.compiler
* java.desktop
* jdk.compiler
*/
import java.awt.Font;
public class TestFontClassJava {
public static void main(String[] args) {
new TestEditor(Font.class).testJava(new Font("Helvetica", Font.ITALIC, 12));
}
}

View file

@ -0,0 +1,41 @@
/*
* Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4506596 6498171 6538853
* @summary Tests PropertyEditor for null value of type Font
* @author Sergey Malenkov
* @key headful
* @modules java.compiler
* java.desktop
* jdk.compiler
*/
import java.awt.Font;
public class TestFontClassNull {
public static void main(String[] args) {
new TestEditor(Font.class).testJava(null);
}
}

View file

@ -0,0 +1,45 @@
/*
* Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4222827 4506596 6538853
* @summary Tests PropertyEditor for value of type Font
* @author Sergey Malenkov
* @key headful
* @modules java.compiler
* java.desktop
* jdk.compiler
*/
import java.awt.Font;
public class TestFontClassValue {
public static void main(String[] args) {
TestEditor test = new TestEditor(Font.class);
test.testValue(new Font("Helvetica", Font.BOLD | Font.ITALIC, 20), "Helvetica BOLDITALIC 20");
test.testValue(null, null);
test.testText("Helvetica 12", new Font("Helvetica", Font.PLAIN, 12));
test.testText(null, null);
}
}

View file

@ -0,0 +1,38 @@
/*
* Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4506596 6498158
* @summary Tests PropertyEditor for value of type Integer
* @author Sergey Malenkov
* @modules java.compiler
* java.desktop
* jdk.compiler
*/
public class TestIntegerClassJava {
public static void main(String[] args) {
new TestEditor(Integer.class).testJava(Integer.valueOf(12));
}
}

View file

@ -0,0 +1,38 @@
/*
* Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4506596 6498158 6498171
* @summary Tests PropertyEditor for null value of type Integer
* @author Sergey Malenkov
* @modules java.compiler
* java.desktop
* jdk.compiler
*/
public class TestIntegerClassNull {
public static void main(String[] args) {
new TestEditor(Integer.class).testJava(null);
}
}

View file

@ -0,0 +1,42 @@
/*
* Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4222827 4506596 6498158
* @summary Tests PropertyEditor for value of type Integer
* @author Sergey Malenkov
* @modules java.compiler
* java.desktop
* jdk.compiler
*/
public class TestIntegerClassValue {
public static void main(String[] args) {
TestEditor test = new TestEditor(Integer.class);
test.testValue(0, "0");
test.testValue(null, null);
test.testText("1", 1);
test.testText(null, null);
}
}

View file

@ -0,0 +1,38 @@
/*
* Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4506596
* @summary Tests PropertyEditor for value of type int
* @author Sergey Malenkov
* @modules java.compiler
* java.desktop
* jdk.compiler
*/
public class TestIntegerTypeJava {
public static void main(String[] args) {
new TestEditor(Integer.TYPE).testJava(Integer.valueOf(12));
}
}

View file

@ -0,0 +1,38 @@
/*
* Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4506596 6498171
* @summary Tests PropertyEditor for null value of type int
* @author Sergey Malenkov
* @modules java.compiler
* java.desktop
* jdk.compiler
*/
public class TestIntegerTypeNull {
public static void main(String[] args) {
new TestEditor(Integer.TYPE).testJava(null);
}
}

View file

@ -0,0 +1,42 @@
/*
* Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4222827 4506596
* @summary Tests PropertyEditor for value of type int
* @author Sergey Malenkov
* @modules java.compiler
* java.desktop
* jdk.compiler
*/
public class TestIntegerTypeValue {
public static void main(String[] args) {
TestEditor test = new TestEditor(Integer.TYPE);
test.testValue(0, "0");
test.testValue(null, null);
test.testText("1", 1);
test.testText(null, null);
}
}

View file

@ -0,0 +1,38 @@
/*
* Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4506596
* @summary Tests PropertyEditor for value of type Long
* @author Sergey Malenkov
* @modules java.compiler
* java.desktop
* jdk.compiler
*/
public class TestLongClassJava {
public static void main(String[] args) {
new TestEditor(Long.class).testJava(Long.valueOf(12));
}
}

View file

@ -0,0 +1,38 @@
/*
* Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4506596 6498171
* @summary Tests PropertyEditor for null value of type Long
* @author Sergey Malenkov
* @modules java.compiler
* java.desktop
* jdk.compiler
*/
public class TestLongClassNull {
public static void main(String[] args) {
new TestEditor(Long.class).testJava(null);
}
}

View file

@ -0,0 +1,42 @@
/*
* Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4222827 4506596
* @summary Tests PropertyEditor for value of type Long
* @author Sergey Malenkov
* @modules java.compiler
* java.desktop
* jdk.compiler
*/
public class TestLongClassValue {
public static void main(String[] args) {
TestEditor test = new TestEditor(Long.class);
test.testValue(0l, "0");
test.testValue(null, null);
test.testText("1", 1l);
test.testText(null, null);
}
}

View file

@ -0,0 +1,38 @@
/*
* Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4506596
* @summary Tests PropertyEditor for value of type long
* @author Sergey Malenkov
* @modules java.compiler
* java.desktop
* jdk.compiler
*/
public class TestLongTypeJava {
public static void main(String[] args) {
new TestEditor(Long.TYPE).testJava(Long.valueOf(12));
}
}

View file

@ -0,0 +1,38 @@
/*
* Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4506596 6498171
* @summary Tests PropertyEditor for null value of type long
* @author Sergey Malenkov
* @modules java.compiler
* java.desktop
* jdk.compiler
*/
public class TestLongTypeNull {
public static void main(String[] args) {
new TestEditor(Long.TYPE).testJava(null);
}
}

View file

@ -0,0 +1,42 @@
/*
* Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4222827 4506596
* @summary Tests PropertyEditor for value of type long
* @author Sergey Malenkov
* @modules java.compiler
* java.desktop
* jdk.compiler
*/
public class TestLongTypeValue {
public static void main(String[] args) {
TestEditor test = new TestEditor(Long.TYPE);
test.testValue(0l, "0");
test.testValue(null, null);
test.testText("1", 1l);
test.testText(null, null);
}
}

View file

@ -0,0 +1,38 @@
/*
* Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4506596
* @summary Tests PropertyEditor for value of type Short
* @author Sergey Malenkov
* @modules java.compiler
* java.desktop
* jdk.compiler
*/
public class TestShortClassJava {
public static void main(String[] args) {
new TestEditor(Short.class).testJava(Short.valueOf((short) 12));
}
}

View file

@ -0,0 +1,38 @@
/*
* Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4506596 6498171
* @summary Tests PropertyEditor for null value of type Short
* @author Sergey Malenkov
* @modules java.compiler
* java.desktop
* jdk.compiler
*/
public class TestShortClassNull {
public static void main(String[] args) {
new TestEditor(Short.class).testJava(null);
}
}

View file

@ -0,0 +1,42 @@
/*
* Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4222827 4506596
* @summary Tests PropertyEditor for value of type Short
* @author Sergey Malenkov
* @modules java.compiler
* java.desktop
* jdk.compiler
*/
public class TestShortClassValue {
public static void main(String[] args) {
TestEditor test = new TestEditor(Short.class);
test.testValue((short) 0, "0");
test.testValue(null, null);
test.testText("1", (short) 1);
test.testText(null, null);
}
}

View file

@ -0,0 +1,38 @@
/*
* Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4506596
* @summary Tests PropertyEditor for value of type short
* @author Sergey Malenkov
* @modules java.compiler
* java.desktop
* jdk.compiler
*/
public class TestShortTypeJava {
public static void main(String[] args) {
new TestEditor(Short.TYPE).testJava(Short.valueOf((short) 12));
}
}

View file

@ -0,0 +1,38 @@
/*
* Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4506596 6498171
* @summary Tests PropertyEditor for null value of type short
* @author Sergey Malenkov
* @modules java.compiler
* java.desktop
* jdk.compiler
*/
public class TestShortTypeNull {
public static void main(String[] args) {
new TestEditor(Short.TYPE).testJava(null);
}
}

View file

@ -0,0 +1,42 @@
/*
* Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4222827 4506596
* @summary Tests PropertyEditor for value of type short
* @author Sergey Malenkov
* @modules java.compiler
* java.desktop
* jdk.compiler
*/
public class TestShortTypeValue {
public static void main(String[] args) {
TestEditor test = new TestEditor(Short.TYPE);
test.testValue((short) 0, "0");
test.testValue(null, null);
test.testText("1", (short) 1);
test.testText(null, null);
}
}

View file

@ -0,0 +1,44 @@
/*
* Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4506596 6457659
* @summary Tests PropertyEditor for value of type String
* @author Sergey Malenkov
* @modules java.compiler
* java.desktop
* jdk.compiler
*/
public class TestStringClassJava {
public static void main(String[] args) {
int length = 0x1000;
StringBuilder sb = new StringBuilder(length);
while (0 < length--)
sb.append((char) length);
new TestEditor(String.class).testJava(sb.toString());
}
}

View file

@ -0,0 +1,38 @@
/*
* Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4506596 6457659 6498171
* @summary Tests PropertyEditor for null value of type String
* @author Sergey Malenkov
* @modules java.compiler
* java.desktop
* jdk.compiler
*/
public class TestStringClassNull {
public static void main(String[] args) {
new TestEditor(String.class).testJava(null);
}
}

View file

@ -0,0 +1,44 @@
/*
* Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4222827
* @bug 4506596
* @bug 6457659
* @summary Tests PropertyEditor for value of type String
* @author Sergey Malenkov
* @modules java.compiler
* java.desktop
* jdk.compiler
*/
public class TestStringClassValue {
public static void main(String[] args) {
TestEditor test = new TestEditor(String.class);
test.testValue("string", "string");
test.testValue(null, null);
test.testText("line", "line");
test.testText(null, null);
}
}