Define an Attribute with a N fields and after specifying N values for them the compiler allows to add a one more ','. The java code compiles with out throwing any error.
The following is code and console.
<code>
public @ann1(isStatic=false,type="class" ,)
class TestM4 {
@ann1(type="class",isStatic=false,) public void myMethod() {
System.out.println(" In side the myMethod");
}
public static void main(String arg[]) {
}
}
@interface ann1 {
String type();
boolean isStatic();
}
</code>
<console>
vishalb:/home/vv145429/tiger/src/metadata/bugs 19 % \rm *.class
vishalb:/home/vv145429/tiger/src/metadata/bugs 20 % c
vishalb:/home/vv145429/tiger/src/metadata/bugs 21 % ls
./ TestM4.java
../ Test1.java TestM4.java~
vishalb:/home/vv145429/tiger/src/metadata/bugs 22 % javac -source 1.5 TestM4.java
vishalb:/home/vv145429/tiger/src/metadata/bugs 24 %
</console>
The following is code and console.
<code>
public @ann1(isStatic=false,type="class" ,)
class TestM4 {
@ann1(type="class",isStatic=false,) public void myMethod() {
System.out.println(" In side the myMethod");
}
public static void main(String arg[]) {
}
}
@interface ann1 {
String type();
boolean isStatic();
}
</code>
<console>
vishalb:/home/vv145429/tiger/src/metadata/bugs 19 % \rm *.class
vishalb:/home/vv145429/tiger/src/metadata/bugs 20 % c
vishalb:/home/vv145429/tiger/src/metadata/bugs 21 % ls
./ TestM4.java
../ Test1.java TestM4.java~
vishalb:/home/vv145429/tiger/src/metadata/bugs 22 % javac -source 1.5 TestM4.java
vishalb:/home/vv145429/tiger/src/metadata/bugs 24 %
</console>