forked from phoedos/pmd
[java] Add test case for #1780
This commit is contained in:
@@ -357,4 +357,9 @@ class ParserCornersTest extends BaseJavaTreeDumpTest {
|
||||
void testGitHubBug3642() {
|
||||
doTest("GitHubBug3642");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testGitHubBug1780() {
|
||||
doTest("GitHubBug1780OuterClass");
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,21 @@
|
||||
package com.pmd.test;
|
||||
|
||||
public class GitHubBug1780OuterClass {
|
||||
public GitHubBug1780OuterClass() {
|
||||
System.out.println("Inner Class AdapterClass");
|
||||
}
|
||||
public class InnerClass {
|
||||
public InnerClass() {
|
||||
System.out.println("Inner Class Constructor");
|
||||
}
|
||||
}
|
||||
private static class StaticInnerClass extends InnerClass {
|
||||
public StaticInnerClass() {
|
||||
new GitHubBug1780OuterClass().super();
|
||||
System.out.println("StaticInnerClass Constructor");
|
||||
}
|
||||
}
|
||||
public static void main(String args[]) {
|
||||
new GitHubBug1780OuterClass.StaticInnerClass();
|
||||
}
|
||||
}
|
@@ -0,0 +1,68 @@
|
||||
+- CompilationUnit[@PackageName = "com.pmd.test"]
|
||||
+- PackageDeclaration[@Name = "com.pmd.test"]
|
||||
| +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"]
|
||||
+- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "com.pmd.test.GitHubBug1780OuterClass", @CanonicalName = "com.pmd.test.GitHubBug1780OuterClass", @EffectiveVisibility = Visibility.V_PUBLIC, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "com.pmd.test", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "GitHubBug1780OuterClass", @Static = false, @TopLevel = true, @Visibility = Visibility.V_PUBLIC]
|
||||
+- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"]
|
||||
+- ClassBody[@Empty = false, @Size = 4]
|
||||
+- ConstructorDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @Image = "GitHubBug1780OuterClass", @Name = "GitHubBug1780OuterClass", @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @containsComment = false]
|
||||
| +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"]
|
||||
| +- FormalParameters[@Empty = true, @Size = 0]
|
||||
| +- Block[@Empty = false, @Size = 1, @containsComment = false]
|
||||
| +- ExpressionStatement[]
|
||||
| +- MethodCall[@CompileTimeConstant = false, @Image = "println", @MethodName = "println", @ParenthesisDepth = 0, @Parenthesized = false]
|
||||
| +- FieldAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "out", @Name = "out", @ParenthesisDepth = 0, @Parenthesized = false]
|
||||
| | +- TypeExpression[@CompileTimeConstant = false, @ParenthesisDepth = 0, @Parenthesized = false]
|
||||
| | +- ClassType[@FullyQualified = false, @SimpleName = "System"]
|
||||
| +- ArgumentList[@Empty = false, @Size = 1]
|
||||
| +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "Inner Class AdapterClass", @Empty = false, @Image = "\"Inner Class AdapterClass\"", @Length = 24, @LiteralText = "\"Inner Class AdapterClass\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false]
|
||||
+- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "com.pmd.test.GitHubBug1780OuterClass$InnerClass", @CanonicalName = "com.pmd.test.GitHubBug1780OuterClass.InnerClass", @EffectiveVisibility = Visibility.V_PUBLIC, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = true, @PackageName = "com.pmd.test", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "InnerClass", @Static = false, @TopLevel = false, @Visibility = Visibility.V_PUBLIC]
|
||||
| +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"]
|
||||
| +- ClassBody[@Empty = false, @Size = 1]
|
||||
| +- ConstructorDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @Image = "InnerClass", @Name = "InnerClass", @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @containsComment = false]
|
||||
| +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"]
|
||||
| +- FormalParameters[@Empty = true, @Size = 0]
|
||||
| +- Block[@Empty = false, @Size = 1, @containsComment = false]
|
||||
| +- ExpressionStatement[]
|
||||
| +- MethodCall[@CompileTimeConstant = false, @Image = "println", @MethodName = "println", @ParenthesisDepth = 0, @Parenthesized = false]
|
||||
| +- FieldAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "out", @Name = "out", @ParenthesisDepth = 0, @Parenthesized = false]
|
||||
| | +- TypeExpression[@CompileTimeConstant = false, @ParenthesisDepth = 0, @Parenthesized = false]
|
||||
| | +- ClassType[@FullyQualified = false, @SimpleName = "System"]
|
||||
| +- ArgumentList[@Empty = false, @Size = 1]
|
||||
| +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "Inner Class Constructor", @Empty = false, @Image = "\"Inner Class Constructor\"", @Length = 23, @LiteralText = "\"Inner Class Constructor\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false]
|
||||
+- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "com.pmd.test.GitHubBug1780OuterClass$StaticInnerClass", @CanonicalName = "com.pmd.test.GitHubBug1780OuterClass.StaticInnerClass", @EffectiveVisibility = Visibility.V_PRIVATE, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = true, @PackageName = "com.pmd.test", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "StaticInnerClass", @Static = true, @TopLevel = false, @Visibility = Visibility.V_PRIVATE]
|
||||
| +- ModifierList[@EffectiveModifiers = "{private, static}", @ExplicitModifiers = "{private, static}"]
|
||||
| +- ExtendsList[@Empty = false, @Size = 1]
|
||||
| | +- ClassType[@FullyQualified = false, @SimpleName = "InnerClass"]
|
||||
| +- ClassBody[@Empty = false, @Size = 1]
|
||||
| +- ConstructorDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PRIVATE, @Final = false, @Image = "StaticInnerClass", @Name = "StaticInnerClass", @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @containsComment = false]
|
||||
| +- ModifierList[@EffectiveModifiers = "{public}", @ExplicitModifiers = "{public}"]
|
||||
| +- FormalParameters[@Empty = true, @Size = 0]
|
||||
| +- Block[@Empty = false, @Size = 2, @containsComment = false]
|
||||
| +- ExplicitConstructorInvocation[@ArgumentCount = 0, @MethodName = "new", @Qualified = true, @Super = true, @This = false]
|
||||
| | +- ConstructorCall[@AnonymousClass = false, @CompileTimeConstant = false, @DiamondTypeArgs = false, @MethodName = "new", @ParenthesisDepth = 0, @Parenthesized = false, @QualifiedInstanceCreation = false]
|
||||
| | | +- ClassType[@FullyQualified = false, @SimpleName = "GitHubBug1780OuterClass"]
|
||||
| | | +- ArgumentList[@Empty = true, @Size = 0]
|
||||
| | +- ArgumentList[@Empty = true, @Size = 0]
|
||||
| +- ExpressionStatement[]
|
||||
| +- MethodCall[@CompileTimeConstant = false, @Image = "println", @MethodName = "println", @ParenthesisDepth = 0, @Parenthesized = false]
|
||||
| +- FieldAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "out", @Name = "out", @ParenthesisDepth = 0, @Parenthesized = false]
|
||||
| | +- TypeExpression[@CompileTimeConstant = false, @ParenthesisDepth = 0, @Parenthesized = false]
|
||||
| | +- ClassType[@FullyQualified = false, @SimpleName = "System"]
|
||||
| +- ArgumentList[@Empty = false, @Size = 1]
|
||||
| +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "StaticInnerClass Constructor", @Empty = false, @Image = "\"StaticInnerClass Constructor\"", @Length = 28, @LiteralText = "\"StaticInnerClass Constructor\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false]
|
||||
+- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @MainMethod = true, @Name = "main", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = true]
|
||||
+- ModifierList[@EffectiveModifiers = "{public, static}", @ExplicitModifiers = "{public, static}"]
|
||||
+- VoidType[]
|
||||
+- FormalParameters[@Empty = false, @Size = 1]
|
||||
| +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL]
|
||||
| +- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"]
|
||||
| +- ClassType[@FullyQualified = false, @SimpleName = "String"]
|
||||
| +- VariableId[@ArrayType = true, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "args", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL]
|
||||
| +- ArrayDimensions[@Empty = false, @Size = 1]
|
||||
| +- ArrayTypeDim[@Varargs = false]
|
||||
+- Block[@Empty = false, @Size = 1, @containsComment = false]
|
||||
+- ExpressionStatement[]
|
||||
+- ConstructorCall[@AnonymousClass = false, @CompileTimeConstant = false, @DiamondTypeArgs = false, @MethodName = "new", @ParenthesisDepth = 0, @Parenthesized = false, @QualifiedInstanceCreation = false]
|
||||
+- ClassType[@FullyQualified = false, @SimpleName = "StaticInnerClass"]
|
||||
| +- ClassType[@FullyQualified = false, @SimpleName = "GitHubBug1780OuterClass"]
|
||||
+- ArgumentList[@Empty = true, @Size = 0]
|
Reference in New Issue
Block a user