Relates :
|
|
Relates :
|
|
Relates :
|
FULL PRODUCT VERSION : java version "1.5.0_10" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_10-b03) Java HotSpot(TM) Client VM (build 1.5.0_10-b03, mixed mode, sharing) java version "1.6.0" Java(TM) SE Runtime Environment (build 1.6.0-b105) Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode, sharing) ADDITIONAL OS VERSION INFORMATION : linux 2.6.18.6 A DESCRIPTION OF THE PROBLEM : When a method or constructor has a varargs argument, the 'transient' modifier is set. This bug appears in JDK 1.5.0_10 and JDK 1.6.0 STEPS TO FOLLOW TO REPRODUCE THE PROBLEM : Copy the submitted source code to a file named 'showbug.java'. Compile and run. EXPECTED VERSUS ACTUAL BEHAVIOR : EXPECTED - No output. ACTUAL - testclass ctor has illegal transient modifier. hello has illegal transient modifier. REPRODUCIBILITY : This bug can be reproduced always. ---------- BEGIN SOURCE ---------- import java.lang.reflect.Constructor; import java.lang.reflect.Method; import static java.lang.reflect.Modifier.*; class testclass { public testclass(int k, float [] f, boolean ... args) {} public void hello(boolean ... args) {} public void hello2() {} } public class showbug { public static void main(String [] args) throws Exception { Class clazz = Class.forName("testclass"); Constructor [] ctors = clazz.getDeclaredConstructors(); // This shows the bug. for ( Constructor ctor : ctors ) { if ( (ctor.getModifiers() & TRANSIENT) != 0 ) { System.out.println(ctor.getName() + " ctor has illegal transient modifier."); } } // This shows the bug. Method hello = clazz.getMethod("hello", boolean[].class); if ( (hello.getModifiers() & TRANSIENT) != 0 ) { System.out.println(hello.getName() + " has illegal transient modifier."); } // This works as expected. Method hello2 = clazz.getMethod("hello2"); if ( (hello2.getModifiers() & TRANSIENT) != 0 ) { System.out.println(hello2.getName() + " has illegal transient modifier."); } } } ---------- END SOURCE ----------
|