Skip to content

Commit

Permalink
Prep for #395: correct modifiers
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-milles committed Aug 23, 2018
1 parent 2af7a23 commit 564aa80
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public void testInlineDeclaration() {
"public @B class A {\n" +
" public A() {\n" +
" }\n" +
" public static void main(public String... argv) {\n" +
" public static void main(String... argv) {\n" +
" }\n" +
"}\n" +
"public @interface B extends java.lang.annotation.Annotation {\n" +
Expand Down Expand Up @@ -607,7 +607,7 @@ public void testMethodLevelAnnotations() {

runConformTest(sources, "success");

checkGCUDeclaration("X.groovy", "public static @Anno void main(public String... argv) {");
checkGCUDeclaration("X.groovy", "public static @Anno void main(String... argv) {");

checkDisassemblyFor("p/X.class",
" @p.Anno\n" +
Expand Down Expand Up @@ -777,7 +777,7 @@ public void testConstructorLevelAnnotations() {

runConformTest(sources, "success");

checkGCUDeclaration("X.groovy", "public @Anno X(public String s) {");
checkGCUDeclaration("X.groovy", "public @Anno X(String s) {");

checkDisassemblyFor("p/X.class",
" @p.Anno\n" +
Expand Down Expand Up @@ -808,7 +808,7 @@ public void testAnnotations04_defaultParamMethods() {

checkGCUDeclaration("X.groovy", "public @Anno void foo() {");

checkGCUDeclaration("X.groovy", "public @Anno void foo(public String s) {");
checkGCUDeclaration("X.groovy", "public @Anno void foo(String s) {");
}

@Test
Expand Down Expand Up @@ -895,7 +895,7 @@ public void testMethodLevelAnnotations_SingleMember1() {

runConformTest(sources, "success");

checkGCUDeclaration("X.groovy", "public @Anno(Target.class) void foo(public String s) {");
checkGCUDeclaration("X.groovy", "public @Anno(Target.class) void foo(String s) {");
}

@Test
Expand Down Expand Up @@ -924,7 +924,7 @@ public void testMethodLevelAnnotations_SingleMember2() {

runConformTest(sources, "success");

checkGCUDeclaration("X.groovy", "public @Anno(p.Target.class) void foo(public String s) {");
checkGCUDeclaration("X.groovy", "public @Anno(p.Target.class) void foo(String s) {");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ public void testParsingRecovery_IncompleteAssignment1() {
"public class X extends groovy.lang.Script {\n" +
" public X() {\n" +
" }\n" +
" public X(public groovy.lang.Binding context) {\n" +
" public X(groovy.lang.Binding context) {\n" +
" }\n" +
" public static void main(public java.lang.String... args) {\n" +
" public static void main(java.lang.String... args) {\n" +
" }\n" +
" public java.lang.Object run() {\n" +
" }\n" +
Expand All @@ -114,9 +114,9 @@ public void testParsingRecovery_IncompleteAssignment1a() {
"public class X extends groovy.lang.Script {\n" +
" public X() {\n" +
" }\n" +
" public X(public groovy.lang.Binding context) {\n" +
" public X(groovy.lang.Binding context) {\n" +
" }\n" +
" public static void main(public java.lang.String... args) {\n" +
" public static void main(java.lang.String... args) {\n" +
" }\n" +
" public java.lang.Object run() {\n" +
" }\n" +
Expand All @@ -141,9 +141,9 @@ public void testParsingRecovery_IncompleteAssignment1b() {
"public class X extends groovy.lang.Script {\n" +
" public X() {\n" +
" }\n" +
" public X(public groovy.lang.Binding context) {\n" +
" public X(groovy.lang.Binding context) {\n" +
" }\n" +
" public static void main(public java.lang.String... args) {\n" +
" public static void main(java.lang.String... args) {\n" +
" }\n" +
" public java.lang.Object run() {\n" +
" }\n" +
Expand All @@ -168,9 +168,9 @@ public void testParsingRecovery_IncompleteAssignment1c() {
"public class X extends groovy.lang.Script {\n" +
" public X() {\n" +
" }\n" +
" public X(public groovy.lang.Binding context) {\n" +
" public X(groovy.lang.Binding context) {\n" +
" }\n" +
" public static void main(public java.lang.String... args) {\n" +
" public static void main(java.lang.String... args) {\n" +
" }\n" +
" public java.lang.Object run() {\n" +
" }\n" +
Expand Down Expand Up @@ -341,9 +341,9 @@ public void testParsingRecovery_IncompleteRangeExpression1() {
"public class X extends groovy.lang.Script {\n" +
" public X() {\n" +
" }\n" +
" public X(public groovy.lang.Binding context) {\n" +
" public X(groovy.lang.Binding context) {\n" +
" }\n" +
" public static void main(public java.lang.String... args) {\n" +
" public static void main(java.lang.String... args) {\n" +
" }\n" +
" public java.lang.Object run() {\n" +
" }\n" +
Expand All @@ -369,9 +369,9 @@ public void testParsingRecovery_IncompleteRangeExpression2() {
"public class X extends groovy.lang.Script {\n" +
" public X() {\n" +
" }\n" +
" public X(public groovy.lang.Binding context) {\n" +
" public X(groovy.lang.Binding context) {\n" +
" }\n" +
" public static void main(public java.lang.String... args) {\n" +
" public static void main(java.lang.String... args) {\n" +
" }\n" +
" public java.lang.Object run() {\n" +
" }\n" +
Expand All @@ -397,9 +397,9 @@ public void testParsingRecovery_IncompleteRangeExpression3() {
"public class X extends groovy.lang.Script {\n" +
" public X() {\n" +
" }\n" +
" public X(public groovy.lang.Binding context) {\n" +
" public X(groovy.lang.Binding context) {\n" +
" }\n" +
" public static void main(public java.lang.String... args) {\n" +
" public static void main(java.lang.String... args) {\n" +
" }\n" +
" public java.lang.Object run() {\n" +
" }\n" +
Expand All @@ -425,9 +425,9 @@ public void testParsingRecovery_IncompleteRangeExpression4() {
"public class X extends groovy.lang.Script {\n" +
" public X() {\n" +
" }\n" +
" public X(public groovy.lang.Binding context) {\n" +
" public X(groovy.lang.Binding context) {\n" +
" }\n" +
" public static void main(public java.lang.String... args) {\n" +
" public static void main(java.lang.String... args) {\n" +
" }\n" +
" public java.lang.Object run() {\n" +
" }\n" +
Expand Down Expand Up @@ -1020,9 +1020,9 @@ public void testParsingRecovery_GRE468_4() {
"public class X extends groovy.lang.Script {\n" +
" public X() {\n" +
" }\n" +
" public X(public groovy.lang.Binding context) {\n" +
" public X(groovy.lang.Binding context) {\n" +
" }\n" +
" public static void main(public java.lang.String... args) {\n" +
" public static void main(java.lang.String... args) {\n" +
" }\n" +
" public java.lang.Object run() {\n" +
" }\n" +
Expand Down Expand Up @@ -1182,9 +1182,9 @@ public void testParsingRecovery_GRE468_9() {
"public class X extends groovy.lang.Script {\n" +
" public X() {\n" +
" }\n" +
" public X(public groovy.lang.Binding context) {\n" +
" public X(groovy.lang.Binding context) {\n" +
" }\n" +
" public static void main(public java.lang.String... args) {\n" +
" public static void main(java.lang.String... args) {\n" +
" }\n" +
" public java.lang.Object run() {\n" +
" }\n" +
Expand Down Expand Up @@ -1250,7 +1250,7 @@ public void testParsingRecovery_GRE494_1() {
" }\n" +
" public java.lang.Object getNumber() {\n" +
" }\n" +
" public static void main(public java.lang.String... args) {\n" +
" public static void main(java.lang.String... args) {\n" +
" }\n" +
"}\n");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1065,10 +1065,7 @@ public void testStandaloneGroovyFile2() {
"public class X {\n" +
" public X() {\n" +
" }\n" +
// for: public static void main(String[] args) {
//" public static void main(public String... args) {\n" +
// for: static main(args) {
" public static void main(public java.lang.String... args) {\n" +
" public static void main(java.lang.String... args) {\n" +
" }\n" +
"}\n"
);
Expand All @@ -1091,7 +1088,7 @@ public void testParentIsObject_GRE528() {
"public class X {\n" +
" public X() {\n" +
" }\n" +
" public static void main(public java.lang.String... args) {\n" +
" public static void main(java.lang.String... args) {\n" +
" }\n" +
"}\n"
);
Expand Down Expand Up @@ -1120,7 +1117,7 @@ public void testInnerTypes() {
" }\n"+
" public X() {\n" +
" }\n" +
" public static void main(public java.lang.String... args) {\n" +
" public static void main(java.lang.String... args) {\n" +
" }\n" +
"}\n"
);
Expand Down Expand Up @@ -4003,9 +4000,9 @@ public void testDefaultValueMethods() {
"public class G {\n" +
" public G() {\n" +
" }\n" +
" public void m(public String s, public Integer i) {\n" +
" public void m(String s, Integer i) {\n" +
" }\n" +
" public void m(public String s) {\n" +
" public void m(String s) {\n" +
" }\n" +
"}\n";
checkGCUDeclaration("G.groovy",expectedOutput);
Expand Down Expand Up @@ -4050,13 +4047,13 @@ public void testDefaultValueMethods02() {
"public class G {\n" +
" public G() {\n" +
" }\n" +
" public void m(public String s, public Integer i, public String j, public String k, public float f, public String l) {\n" +
" public void m(String s, Integer i, String j, String k, float f, String l) {\n" +
" }\n" +
" public void m(public String s, public Integer i, public String j, public String k, public String l) {\n" +
" public void m(String s, Integer i, String j, String k, String l) {\n" +
" }\n" +
" public void m(public String s, public Integer i, public String k, public String l) {\n" +
" public void m(String s, Integer i, String k, String l) {\n" +
" }\n" +
" public void m(public String s, public String k, public String l) {\n" +
" public void m(String s, String k, String l) {\n" +
" }\n" +
"}\n";
checkGCUDeclaration("G.groovy", expectedOutput);
Expand Down Expand Up @@ -4111,16 +4108,16 @@ public void testDefaultValueConstructors() {
"package p;\n" +
"public class G {\n" +
" private java.lang.Object msg;\n" +
" public G(public Integer i, public String m) {\n" +
" public G(Integer i, String m) {\n" +
" }\n" +
" public G(public Integer i) {\n" +
" public G(Integer i) {\n" +
" }\n" +
" public void print(public int i) {\n" +
" public void print(int i) {\n" +
" }\n" +
" public void print() {\n" +
" }\n" +
"}\n";
checkGCUDeclaration("G.groovy", expectedOutput );
checkGCUDeclaration("G.groovy", expectedOutput);
expectedOutput =
" \n" +
" public G(Integer i, String m);\n" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,7 @@ protected Expression anonymousInnerClassDef(AST node) {
if (enumConstantBeingDef) {
classNode = new EnumConstantClassNode(outerClass, fullName, Opcodes.ACC_PUBLIC, ClassHelper.OBJECT_TYPE);
} else {
classNode = new InnerClassNode(outerClass, fullName, Opcodes.ACC_PUBLIC, ClassHelper.OBJECT_TYPE);
classNode = new InnerClassNode(outerClass, fullName, /*GRECLIPSE Opcodes.ACC_PUBLIC*/0, ClassHelper.OBJECT_TYPE);
}
((InnerClassNode) classNode).setAnonymous(true);
classNode.setEnclosingMethod(methodNode);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,7 @@ protected Expression anonymousInnerClassDef(AST node) {
if (enumConstantBeingDef) {
classNode = new EnumConstantClassNode(outerClass, fullName, Opcodes.ACC_PUBLIC, ClassHelper.OBJECT_TYPE);
} else {
classNode = new InnerClassNode(outerClass, fullName, Opcodes.ACC_PUBLIC, ClassHelper.OBJECT_TYPE);
classNode = new InnerClassNode(outerClass, fullName, /*GRECLIPSE Opcodes.ACC_PUBLIC*/0, ClassHelper.OBJECT_TYPE);
}
((InnerClassNode) classNode).setAnonymous(true);
classNode.setEnclosingMethod(methodNode);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3726,7 +3726,7 @@ public InnerClassNode visitAnonymousInnerClassDeclaration(AnonymousInnerClassDec
// and remove the final modifier from classNode to allow the sub class
superClass.setModifiers(superClass.getModifiers() & ~Opcodes.ACC_FINAL);
} else { // anonymous inner class
anonymousInnerClass = new InnerClassNode(outerClass, fullName, Opcodes.ACC_PUBLIC, superClass);
anonymousInnerClass = new InnerClassNode(outerClass, fullName, /*GRECLIPSE Opcodes.ACC_PUBLIC*/0, superClass);
}

anonymousInnerClass.setUsingGenerics(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -845,7 +845,7 @@ protected Expression anonymousInnerClassDef(AST node) {
if (enumConstantBeingDef) {
classNode = new EnumConstantClassNode(outerClass, fullName, Opcodes.ACC_PUBLIC, ClassHelper.OBJECT_TYPE);
} else {
classNode = new InnerClassNode(outerClass, fullName, Opcodes.ACC_PUBLIC, ClassHelper.OBJECT_TYPE);
classNode = new InnerClassNode(outerClass, fullName, /*GRECLIPSE Opcodes.ACC_PUBLIC*/0, ClassHelper.OBJECT_TYPE);
}
((InnerClassNode) classNode).setAnonymous(true);
classNode.setEnclosingMethod(methodNode);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1713,7 +1713,7 @@ private Argument[] createArguments(Parameter[] ps, boolean isMain) {
} else {
pos = toPos(parameter.getStart(), parameter.getEnd() - 1);
}
arguments[i] = new Argument(parameter.getName().toCharArray(), pos, parameterTypeReference, Flags.AccPublic);
arguments[i] = new Argument(parameter.getName().toCharArray(), pos, parameterTypeReference, Flags.AccDefault);
arguments[i].annotations = createAnnotations(parameter.getAnnotations());
arguments[i].declarationSourceStart = pstart;
}
Expand Down Expand Up @@ -2195,7 +2195,6 @@ private int getModifiers(ClassNode node, boolean isInner) {
modifiers &= ~(Flags.AccAbstract | Flags.AccFinal);
}
if (!isInner) {
// TODO: does this make types visible that shouldn't be?
modifiers &= ~(Flags.AccProtected | Flags.AccPrivate | Flags.AccStatic);
}
if (/*node.isSyntheticPublic() &&*/ hasPackageScopeXform(node, PackageScopeTarget.CLASS)) {
Expand Down

0 comments on commit 564aa80

Please sign in to comment.