-
Bug
-
Resolution: Unresolved
-
P4
-
repo-amber
-
generic
-
generic
What modifiers make sense and what don't ?? This needs to be addressed by this ticket.
(1) strictfp is NOT allowed:
public class X {
public static void main(String [] args) {
strictfp void xxx (int y) {
}
}
}
X.java:3: error: class, interface, or enum expected
strictfp void xxx (int y) {
^
1 error
(2) final is accepted as a modifier:
public class X {
public static void main(String [] args) {
final void xxx (int y) {
}
}
}
(3) Is there a valid use case for a local method to be synchronized ??
(4) If the modifier final is present, then it also becomes possible to have modifiers such as public/protected/private:
public class X {
public static void main(String [] args) {
final public void xxx (int y) { // compiles fine, but public does not make sense for local methods ??
}
}
}
(5) Tagging a local method abstract results in a compiler crash:
public class X {
public static void main(String [] args) {
@Override
abstract void xxx (int y);
}
}
java.lang.NullPointerException
at jdk.compiler/com.sun.tools.javac.comp.Flow$CaptureAnalyzer.visitIdent(Flow.java:2811)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCIdent.accept(JCTree.java:2350)
at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
at jdk.compiler/com.sun.tools.javac.comp.Flow$BaseAnalyzer.scan(Flow.java:405)
at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.visitAnnotation(TreeScanner.java:366)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCAnnotation.accept(JCTree.java:2674)
at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
at jdk.compiler/com.sun.tools.javac.comp.Flow$BaseAnalyzer.scan(Flow.java:405)
at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:57)
at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.visitModifiers(TreeScanner.java:362)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCModifiers.accept(JCTree.java:2703)
at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
at jdk.compiler/com.sun.tools.javac.comp.Flow$BaseAnalyzer.scan(Flow.java:405)
at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.visitMethodDef(TreeScanner.java:122)
at jdk.compiler/com.sun.tools.javac.comp.Flow$CaptureAnalyzer.visitMethodDef(Flow.java:2800)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:875)
at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
at jdk.compiler/com.sun.tools.javac.comp.Flow$BaseAnalyzer.scan(Flow.java:405)
at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:57)
at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.visitBlock(TreeScanner.java:143)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1029)
at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
at jdk.compiler/com.sun.tools.javac.comp.Flow$BaseAnalyzer.scan(Flow.java:405)
at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.visitMethodDef(TreeScanner.java:129)
at jdk.compiler/com.sun.tools.javac.comp.Flow$CaptureAnalyzer.visitMethodDef(Flow.java:2805)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:875)
at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
at jdk.compiler/com.sun.tools.javac.comp.Flow$BaseAnalyzer.scan(Flow.java:405)
at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:57)
at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.visitClassDef(TreeScanner.java:118)
at jdk.compiler/com.sun.tools.javac.comp.Flow$CaptureAnalyzer.visitClassDef(Flow.java:2776)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:783)
at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
at jdk.compiler/com.sun.tools.javac.comp.Flow$BaseAnalyzer.scan(Flow.java:405)
at jdk.compiler/com.sun.tools.javac.comp.Flow$CaptureAnalyzer.analyzeTree(Flow.java:2878)
at jdk.compiler/com.sun.tools.javac.comp.Flow$CaptureAnalyzer.analyzeTree(Flow.java:2871)
at jdk.compiler/com.sun.tools.javac.comp.Flow.analyzeTree(Flow.java:218)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1407)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1381)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:973)
at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:318)
at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:176)
at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:57)
at jdk.compiler/com.sun.tools.javac.Main.main(Main.java:43)
There could be other issues too. This ticket can be used to make a comprehensive set of changes for modifier handling.
(1) strictfp is NOT allowed:
public class X {
public static void main(String [] args) {
strictfp void xxx (int y) {
}
}
}
X.java:3: error: class, interface, or enum expected
strictfp void xxx (int y) {
^
1 error
(2) final is accepted as a modifier:
public class X {
public static void main(String [] args) {
final void xxx (int y) {
}
}
}
(3) Is there a valid use case for a local method to be synchronized ??
(4) If the modifier final is present, then it also becomes possible to have modifiers such as public/protected/private:
public class X {
public static void main(String [] args) {
final public void xxx (int y) { // compiles fine, but public does not make sense for local methods ??
}
}
}
(5) Tagging a local method abstract results in a compiler crash:
public class X {
public static void main(String [] args) {
@Override
abstract void xxx (int y);
}
}
java.lang.NullPointerException
at jdk.compiler/com.sun.tools.javac.comp.Flow$CaptureAnalyzer.visitIdent(Flow.java:2811)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCIdent.accept(JCTree.java:2350)
at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
at jdk.compiler/com.sun.tools.javac.comp.Flow$BaseAnalyzer.scan(Flow.java:405)
at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.visitAnnotation(TreeScanner.java:366)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCAnnotation.accept(JCTree.java:2674)
at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
at jdk.compiler/com.sun.tools.javac.comp.Flow$BaseAnalyzer.scan(Flow.java:405)
at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:57)
at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.visitModifiers(TreeScanner.java:362)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCModifiers.accept(JCTree.java:2703)
at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
at jdk.compiler/com.sun.tools.javac.comp.Flow$BaseAnalyzer.scan(Flow.java:405)
at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.visitMethodDef(TreeScanner.java:122)
at jdk.compiler/com.sun.tools.javac.comp.Flow$CaptureAnalyzer.visitMethodDef(Flow.java:2800)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:875)
at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
at jdk.compiler/com.sun.tools.javac.comp.Flow$BaseAnalyzer.scan(Flow.java:405)
at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:57)
at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.visitBlock(TreeScanner.java:143)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1029)
at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
at jdk.compiler/com.sun.tools.javac.comp.Flow$BaseAnalyzer.scan(Flow.java:405)
at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.visitMethodDef(TreeScanner.java:129)
at jdk.compiler/com.sun.tools.javac.comp.Flow$CaptureAnalyzer.visitMethodDef(Flow.java:2805)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:875)
at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
at jdk.compiler/com.sun.tools.javac.comp.Flow$BaseAnalyzer.scan(Flow.java:405)
at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:57)
at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.visitClassDef(TreeScanner.java:118)
at jdk.compiler/com.sun.tools.javac.comp.Flow$CaptureAnalyzer.visitClassDef(Flow.java:2776)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:783)
at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
at jdk.compiler/com.sun.tools.javac.comp.Flow$BaseAnalyzer.scan(Flow.java:405)
at jdk.compiler/com.sun.tools.javac.comp.Flow$CaptureAnalyzer.analyzeTree(Flow.java:2878)
at jdk.compiler/com.sun.tools.javac.comp.Flow$CaptureAnalyzer.analyzeTree(Flow.java:2871)
at jdk.compiler/com.sun.tools.javac.comp.Flow.analyzeTree(Flow.java:218)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1407)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1381)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:973)
at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:318)
at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:176)
at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:57)
at jdk.compiler/com.sun.tools.javac.Main.main(Main.java:43)
There could be other issues too. This ticket can be used to make a comprehensive set of changes for modifier handling.