This code:
public class Modifiers {
private void test() {
class L {
private class Test {}
}
}
}
is rejected by JDK15 javac compiler, but it is accepted if compiled with JDK 16 compiler with source level 15. There is no rule in the spec that restricts the modifiers of members of local classes. If we decide not to keep this non-specified javac behavior, then we can probably close this issue.
Another variation of the same issue:
public class ModifiersAnonymous {
private Object o = new Object() {
private class Test {}
};
}
(reported offline by Jan)
public class Modifiers {
private void test() {
class L {
private class Test {}
}
}
}
is rejected by JDK15 javac compiler, but it is accepted if compiled with JDK 16 compiler with source level 15. There is no rule in the spec that restricts the modifiers of members of local classes. If we decide not to keep this non-specified javac behavior, then we can probably close this issue.
Another variation of the same issue:
public class ModifiersAnonymous {
private Object o = new Object() {
private class Test {}
};
}
(reported offline by Jan)