summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar jeff2014-09-14 23:56:43 -0400
committerGravatar jeff2014-09-14 23:56:43 -0400
commit72e918a5134c2bf747a476284bcfa1bd2ef2fa21 (patch)
tree2fd256d6a8bbe38b7b9fe1892f444a8c29de08ef
parentadded test to check constructor references (diff)
downloadenigma-72e918a5134c2bf747a476284bcfa1bd2ef2fa21.tar.gz
enigma-72e918a5134c2bf747a476284bcfa1bd2ef2fa21.tar.xz
enigma-72e918a5134c2bf747a476284bcfa1bd2ef2fa21.zip
added tests to check constructor tokens
fixed a bug with constructor tokens too
-rw-r--r--src/cuchaz/enigma/analysis/SourceIndex.java10
-rw-r--r--src/cuchaz/enigma/analysis/SourceIndexBehaviorVisitor.java51
-rw-r--r--src/cuchaz/enigma/analysis/SourceIndexClassVisitor.java1
-rw-r--r--test/cuchaz/enigma/TestJarIndexConstructorReferences.java29
-rw-r--r--test/cuchaz/enigma/TestTokensConstructors.java152
-rw-r--r--test/cuchaz/enigma/TokenChecker.java71
-rw-r--r--test/cuchaz/enigma/inputs/constructors/Caller.java15
-rw-r--r--test/cuchaz/enigma/inputs/constructors/DefaultConstructable.java6
-rw-r--r--test/cuchaz/enigma/inputs/constructors/SubClass.java3
-rw-r--r--test/cuchaz/enigma/inputs/constructors/SubSubClass.java2
10 files changed, 316 insertions, 24 deletions
diff --git a/src/cuchaz/enigma/analysis/SourceIndex.java b/src/cuchaz/enigma/analysis/SourceIndex.java
index 1a5a80d6..b777f9fd 100644
--- a/src/cuchaz/enigma/analysis/SourceIndex.java
+++ b/src/cuchaz/enigma/analysis/SourceIndex.java
@@ -20,7 +20,7 @@ import com.google.common.collect.Lists;
20import com.google.common.collect.Maps; 20import com.google.common.collect.Maps;
21import com.google.common.collect.Multimap; 21import com.google.common.collect.Multimap;
22import com.strobel.decompiler.languages.Region; 22import com.strobel.decompiler.languages.Region;
23import com.strobel.decompiler.languages.java.ast.Identifier; 23import com.strobel.decompiler.languages.java.ast.AstNode;
24 24
25import cuchaz.enigma.mapping.Entry; 25import cuchaz.enigma.mapping.Entry;
26 26
@@ -56,7 +56,7 @@ public class SourceIndex
56 return m_source; 56 return m_source;
57 } 57 }
58 58
59 public Token getToken( Identifier node ) 59 public Token getToken( AstNode node )
60 { 60 {
61 // get a token for this node's region 61 // get a token for this node's region
62 Region region = node.getRegion(); 62 Region region = node.getRegion();
@@ -71,7 +71,7 @@ public class SourceIndex
71 ); 71 );
72 72
73 // for tokens representing inner classes, make sure we only get the simple name 73 // for tokens representing inner classes, make sure we only get the simple name
74 int pos = node.getName().lastIndexOf( '$' ); 74 int pos = node.toString().lastIndexOf( '$' );
75 if( pos >= 0 ) 75 if( pos >= 0 )
76 { 76 {
77 token.end -= pos + 1; 77 token.end -= pos + 1;
@@ -92,7 +92,7 @@ public class SourceIndex
92 return token; 92 return token;
93 } 93 }
94 94
95 public void addReference( Identifier node, EntryReference<Entry,Entry> deobfReference ) 95 public void addReference( AstNode node, EntryReference<Entry,Entry> deobfReference )
96 { 96 {
97 Token token = getToken( node ); 97 Token token = getToken( node );
98 if( token != null ) 98 if( token != null )
@@ -102,7 +102,7 @@ public class SourceIndex
102 } 102 }
103 } 103 }
104 104
105 public void addDeclaration( Identifier node, Entry deobfEntry ) 105 public void addDeclaration( AstNode node, Entry deobfEntry )
106 { 106 {
107 Token token = getToken( node ); 107 Token token = getToken( node );
108 if( token != null ) 108 if( token != null )
diff --git a/src/cuchaz/enigma/analysis/SourceIndexBehaviorVisitor.java b/src/cuchaz/enigma/analysis/SourceIndexBehaviorVisitor.java
index ab505528..a1dac4b5 100644
--- a/src/cuchaz/enigma/analysis/SourceIndexBehaviorVisitor.java
+++ b/src/cuchaz/enigma/analysis/SourceIndexBehaviorVisitor.java
@@ -12,9 +12,11 @@ package cuchaz.enigma.analysis;
12 12
13import com.strobel.assembler.metadata.MemberReference; 13import com.strobel.assembler.metadata.MemberReference;
14import com.strobel.assembler.metadata.MethodDefinition; 14import com.strobel.assembler.metadata.MethodDefinition;
15import com.strobel.assembler.metadata.MethodReference;
15import com.strobel.assembler.metadata.ParameterDefinition; 16import com.strobel.assembler.metadata.ParameterDefinition;
16import com.strobel.assembler.metadata.TypeReference; 17import com.strobel.assembler.metadata.TypeReference;
17import com.strobel.decompiler.languages.TextLocation; 18import com.strobel.decompiler.languages.TextLocation;
19import com.strobel.decompiler.languages.java.ast.AstNode;
18import com.strobel.decompiler.languages.java.ast.ConstructorDeclaration; 20import com.strobel.decompiler.languages.java.ast.ConstructorDeclaration;
19import com.strobel.decompiler.languages.java.ast.IdentifierExpression; 21import com.strobel.decompiler.languages.java.ast.IdentifierExpression;
20import com.strobel.decompiler.languages.java.ast.InvocationExpression; 22import com.strobel.decompiler.languages.java.ast.InvocationExpression;
@@ -24,6 +26,8 @@ import com.strobel.decompiler.languages.java.ast.MethodDeclaration;
24import com.strobel.decompiler.languages.java.ast.ObjectCreationExpression; 26import com.strobel.decompiler.languages.java.ast.ObjectCreationExpression;
25import com.strobel.decompiler.languages.java.ast.ParameterDeclaration; 27import com.strobel.decompiler.languages.java.ast.ParameterDeclaration;
26import com.strobel.decompiler.languages.java.ast.SimpleType; 28import com.strobel.decompiler.languages.java.ast.SimpleType;
29import com.strobel.decompiler.languages.java.ast.SuperReferenceExpression;
30import com.strobel.decompiler.languages.java.ast.ThisReferenceExpression;
27 31
28import cuchaz.enigma.mapping.ArgumentEntry; 32import cuchaz.enigma.mapping.ArgumentEntry;
29import cuchaz.enigma.mapping.BehaviorEntry; 33import cuchaz.enigma.mapping.BehaviorEntry;
@@ -58,14 +62,49 @@ public class SourceIndexBehaviorVisitor extends SourceIndexVisitor
58 public Void visitInvocationExpression( InvocationExpression node, SourceIndex index ) 62 public Void visitInvocationExpression( InvocationExpression node, SourceIndex index )
59 { 63 {
60 MemberReference ref = node.getUserData( Keys.MEMBER_REFERENCE ); 64 MemberReference ref = node.getUserData( Keys.MEMBER_REFERENCE );
65
66 // get the behavior entry
61 ClassEntry classEntry = new ClassEntry( ref.getDeclaringType().getInternalName() ); 67 ClassEntry classEntry = new ClassEntry( ref.getDeclaringType().getInternalName() );
62 if( node.getTarget() instanceof MemberReferenceExpression ) 68 BehaviorEntry behaviorEntry = null;
69 if( ref instanceof MethodReference )
63 { 70 {
64 MethodEntry methodEntry = new MethodEntry( classEntry, ref.getName(), ref.getSignature() ); 71 MethodReference methodRef = (MethodReference)ref;
65 index.addReference( 72 if( methodRef.isConstructor() )
66 ((MemberReferenceExpression)node.getTarget()).getMemberNameToken(), 73 {
67 new EntryReference<Entry,Entry>( methodEntry, m_behaviorEntry ) 74 behaviorEntry = new ConstructorEntry( classEntry, ref.getSignature() );
68 ); 75 }
76 else if( methodRef.isTypeInitializer() )
77 {
78 behaviorEntry = new ConstructorEntry( classEntry );
79 }
80 else
81 {
82 behaviorEntry = new MethodEntry( classEntry, ref.getName(), ref.getSignature() );
83 }
84 }
85 if( behaviorEntry != null )
86 {
87 // get the node for the token
88 AstNode tokenNode = null;
89 if( node.getTarget() instanceof MemberReferenceExpression )
90 {
91 tokenNode = ((MemberReferenceExpression)node.getTarget()).getMemberNameToken();
92 }
93 else if( node.getTarget() instanceof SuperReferenceExpression )
94 {
95 tokenNode = node.getTarget();
96 }
97 else if( node.getTarget() instanceof ThisReferenceExpression )
98 {
99 tokenNode = node.getTarget();
100 }
101 if( tokenNode != null )
102 {
103 index.addReference(
104 tokenNode,
105 new EntryReference<Entry,Entry>( behaviorEntry, m_behaviorEntry )
106 );
107 }
69 } 108 }
70 109
71 return recurse( node, index ); 110 return recurse( node, index );
diff --git a/src/cuchaz/enigma/analysis/SourceIndexClassVisitor.java b/src/cuchaz/enigma/analysis/SourceIndexClassVisitor.java
index a1c82711..b7897268 100644
--- a/src/cuchaz/enigma/analysis/SourceIndexClassVisitor.java
+++ b/src/cuchaz/enigma/analysis/SourceIndexClassVisitor.java
@@ -97,7 +97,6 @@ public class SourceIndexClassVisitor extends SourceIndexVisitor
97 ClassEntry classEntry = new ClassEntry( def.getDeclaringType().getInternalName() ); 97 ClassEntry classEntry = new ClassEntry( def.getDeclaringType().getInternalName() );
98 ConstructorEntry constructorEntry = new ConstructorEntry( classEntry, def.getSignature() ); 98 ConstructorEntry constructorEntry = new ConstructorEntry( classEntry, def.getSignature() );
99 index.addDeclaration( node.getNameToken(), constructorEntry ); 99 index.addDeclaration( node.getNameToken(), constructorEntry );
100
101 return node.acceptVisitor( new SourceIndexBehaviorVisitor( constructorEntry ), index ); 100 return node.acceptVisitor( new SourceIndexBehaviorVisitor( constructorEntry ), index );
102 } 101 }
103 102
diff --git a/test/cuchaz/enigma/TestJarIndexConstructorReferences.java b/test/cuchaz/enigma/TestJarIndexConstructorReferences.java
index 38882a0c..c0691888 100644
--- a/test/cuchaz/enigma/TestJarIndexConstructorReferences.java
+++ b/test/cuchaz/enigma/TestJarIndexConstructorReferences.java
@@ -18,10 +18,13 @@ import static org.hamcrest.Matchers.containsInAnyOrder;
18import static org.hamcrest.Matchers.empty; 18import static org.hamcrest.Matchers.empty;
19import static org.hamcrest.Matchers.is; 19import static org.hamcrest.Matchers.is;
20 20
21import java.io.File;
22import java.util.Collection;
21import java.util.jar.JarFile; 23import java.util.jar.JarFile;
22 24
23import org.junit.Test; 25import org.junit.Test;
24 26
27import cuchaz.enigma.analysis.EntryReference;
25import cuchaz.enigma.analysis.JarIndex; 28import cuchaz.enigma.analysis.JarIndex;
26import cuchaz.enigma.mapping.BehaviorEntry; 29import cuchaz.enigma.mapping.BehaviorEntry;
27import cuchaz.enigma.mapping.ClassEntry; 30import cuchaz.enigma.mapping.ClassEntry;
@@ -30,17 +33,19 @@ import cuchaz.enigma.mapping.ConstructorEntry;
30public class TestJarIndexConstructorReferences 33public class TestJarIndexConstructorReferences
31{ 34{
32 private JarIndex m_index; 35 private JarIndex m_index;
33 36
34 private ClassEntry m_baseClass = new ClassEntry( "none/a" ); 37 private ClassEntry m_baseClass = new ClassEntry( "none/a" );
35 private ClassEntry m_subClass = new ClassEntry( "none/c" ); 38 private ClassEntry m_subClass = new ClassEntry( "none/d" );
36 private ClassEntry m_subsubClass = new ClassEntry( "none/d" ); 39 private ClassEntry m_subsubClass = new ClassEntry( "none/e" );
40 private ClassEntry m_defaultClass = new ClassEntry( "none/c" );
37 private ClassEntry m_callerClass = new ClassEntry( "none/b" ); 41 private ClassEntry m_callerClass = new ClassEntry( "none/b" );
38 42
39 public TestJarIndexConstructorReferences( ) 43 public TestJarIndexConstructorReferences( )
40 throws Exception 44 throws Exception
41 { 45 {
46 File jarFile = new File( "build/libs/testConstructors.obf.jar" );
42 m_index = new JarIndex(); 47 m_index = new JarIndex();
43 m_index.indexJar( new JarFile( "build/libs/testConstructors.obf.jar" ), false ); 48 m_index.indexJar( new JarFile( jarFile ), false );
44 } 49 }
45 50
46 @Test 51 @Test
@@ -51,6 +56,7 @@ public class TestJarIndexConstructorReferences
51 m_baseClass, 56 m_baseClass,
52 m_subClass, 57 m_subClass,
53 m_subsubClass, 58 m_subsubClass,
59 m_defaultClass,
54 m_callerClass 60 m_callerClass
55 ) ); 61 ) );
56 } 62 }
@@ -60,7 +66,8 @@ public class TestJarIndexConstructorReferences
60 public void baseDefault( ) 66 public void baseDefault( )
61 { 67 {
62 BehaviorEntry source = new ConstructorEntry( m_baseClass, "()V" ); 68 BehaviorEntry source = new ConstructorEntry( m_baseClass, "()V" );
63 assertThat( m_index.getBehaviorReferences( source ), containsInAnyOrder( 69 Collection<EntryReference<BehaviorEntry,BehaviorEntry>> references = m_index.getBehaviorReferences( source );
70 assertThat( references, containsInAnyOrder(
64 newBehaviorReferenceByMethod( source, m_callerClass.getName(), "a", "()V" ), 71 newBehaviorReferenceByMethod( source, m_callerClass.getName(), "a", "()V" ),
65 newBehaviorReferenceByConstructor( source, m_subClass.getName(), "()V" ), 72 newBehaviorReferenceByConstructor( source, m_subClass.getName(), "()V" ),
66 newBehaviorReferenceByConstructor( source, m_subClass.getName(), "(III)V" ) 73 newBehaviorReferenceByConstructor( source, m_subClass.getName(), "(III)V" )
@@ -126,4 +133,14 @@ public class TestJarIndexConstructorReferences
126 newBehaviorReferenceByMethod( source, m_callerClass.getName(), "f", "()V" ) 133 newBehaviorReferenceByMethod( source, m_callerClass.getName(), "f", "()V" )
127 ) ); 134 ) );
128 } 135 }
136
137 @Test
138 @SuppressWarnings( "unchecked" )
139 public void defaultConstructable( )
140 {
141 BehaviorEntry source = new ConstructorEntry( m_defaultClass, "()V" );
142 assertThat( m_index.getBehaviorReferences( source ), containsInAnyOrder(
143 newBehaviorReferenceByMethod( source, m_callerClass.getName(), "g", "()V" )
144 ) );
145 }
129} 146}
diff --git a/test/cuchaz/enigma/TestTokensConstructors.java b/test/cuchaz/enigma/TestTokensConstructors.java
new file mode 100644
index 00000000..24091532
--- /dev/null
+++ b/test/cuchaz/enigma/TestTokensConstructors.java
@@ -0,0 +1,152 @@
1/*******************************************************************************
2 * Copyright (c) 2014 Jeff Martin.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the GNU Public License v3.0
5 * which accompanies this distribution, and is available at
6 * http://www.gnu.org/licenses/gpl.html
7 *
8 * Contributors:
9 * Jeff Martin - initial API and implementation
10 ******************************************************************************/
11package cuchaz.enigma;
12
13import static cuchaz.enigma.EntryFactory.newBehaviorReferenceByConstructor;
14import static cuchaz.enigma.EntryFactory.newBehaviorReferenceByMethod;
15import static cuchaz.enigma.EntryFactory.newConstructor;
16import static org.hamcrest.MatcherAssert.assertThat;
17import static org.hamcrest.Matchers.containsInAnyOrder;
18import static org.hamcrest.Matchers.is;
19import static org.hamcrest.Matchers.nullValue;
20
21import java.io.File;
22
23import org.junit.Test;
24
25import cuchaz.enigma.mapping.BehaviorEntry;
26
27public class TestTokensConstructors extends TokenChecker
28{
29 public TestTokensConstructors( )
30 throws Exception
31 {
32 super( new File( "build/libs/testConstructors.obf.jar" ) );
33 }
34
35 @Test
36 public void baseDeclarations( )
37 {
38 assertThat( getDeclarationToken( newConstructor( "none/a", "()V" ) ), is( "a" ) );
39 assertThat( getDeclarationToken( newConstructor( "none/a", "(I)V" ) ), is( "a" ) );
40 }
41
42 @Test
43 public void subDeclarations( )
44 {
45 assertThat( getDeclarationToken( newConstructor( "none/d", "()V" ) ), is( "d" ) );
46 assertThat( getDeclarationToken( newConstructor( "none/d", "(I)V" ) ), is( "d" ) );
47 assertThat( getDeclarationToken( newConstructor( "none/d", "(II)V" ) ), is( "d" ) );
48 assertThat( getDeclarationToken( newConstructor( "none/d", "(III)V" ) ), is( "d" ) );
49 }
50
51 @Test
52 public void subsubDeclarations( )
53 {
54 assertThat( getDeclarationToken( newConstructor( "none/e", "(I)V" ) ), is( "e" ) );
55 }
56
57 @Test
58 public void defaultDeclarations( )
59 {
60 assertThat( getDeclarationToken( newConstructor( "none/c", "()V" ) ), nullValue() );
61 }
62
63 @Test
64 public void baseDefaultReferences( )
65 {
66 BehaviorEntry source = newConstructor( "none/a", "()V" );
67 assertThat(
68 getReferenceTokens( newBehaviorReferenceByMethod( source, "none/b", "a", "()V" ) ),
69 containsInAnyOrder( "a" )
70 );
71 assertThat(
72 getReferenceTokens( newBehaviorReferenceByConstructor( source, "none/d", "()V" ) ),
73 containsInAnyOrder( "super" ) // implicit call, decompiled to "super"
74 );
75 assertThat(
76 getReferenceTokens( newBehaviorReferenceByConstructor( source, "none/d", "(III)V" ) ),
77 containsInAnyOrder( "super" ) // implicit call, decompiled to "super"
78 );
79 }
80
81 @Test
82 public void baseIntReferences( )
83 {
84 BehaviorEntry source = newConstructor( "none/a", "(I)V" );
85 assertThat(
86 getReferenceTokens( newBehaviorReferenceByMethod( source, "none/b", "b", "()V" ) ),
87 containsInAnyOrder( "a" )
88 );
89 }
90
91 @Test
92 public void subDefaultReferences( )
93 {
94 BehaviorEntry source = newConstructor( "none/d", "()V" );
95 assertThat(
96 getReferenceTokens( newBehaviorReferenceByMethod( source, "none/b", "c", "()V" ) ),
97 containsInAnyOrder( "d" )
98 );
99 assertThat(
100 getReferenceTokens( newBehaviorReferenceByConstructor( source, "none/d", "(I)V" ) ),
101 containsInAnyOrder( "this" )
102 );
103 }
104
105 @Test
106 public void subIntReferences( )
107 {
108 BehaviorEntry source = newConstructor( "none/d", "(I)V" );
109 assertThat(
110 getReferenceTokens( newBehaviorReferenceByMethod( source, "none/b", "d", "()V" ) ),
111 containsInAnyOrder( "d" )
112 );
113 assertThat(
114 getReferenceTokens( newBehaviorReferenceByConstructor( source, "none/d", "(II)V" ) ),
115 containsInAnyOrder( "this" )
116 );
117 assertThat(
118 getReferenceTokens( newBehaviorReferenceByConstructor( source, "none/e", "(I)V" ) ),
119 containsInAnyOrder( "super" )
120 );
121 }
122
123 @Test
124 public void subIntIntReferences( )
125 {
126 BehaviorEntry source = newConstructor( "none/d", "(II)V" );
127 assertThat(
128 getReferenceTokens( newBehaviorReferenceByMethod( source, "none/b", "e", "()V" ) ),
129 containsInAnyOrder( "d" )
130 );
131 }
132
133 @Test
134 public void subsubIntReferences( )
135 {
136 BehaviorEntry source = newConstructor( "none/e", "(I)V" );
137 assertThat(
138 getReferenceTokens( newBehaviorReferenceByMethod( source, "none/b", "f", "()V" ) ),
139 containsInAnyOrder( "e" )
140 );
141 }
142
143 @Test
144 public void defaultConstructableReferences( )
145 {
146 BehaviorEntry source = newConstructor( "none/c", "()V" );
147 assertThat(
148 getReferenceTokens( newBehaviorReferenceByMethod( source, "none/b", "g", "()V" ) ),
149 containsInAnyOrder( "c" )
150 );
151 }
152}
diff --git a/test/cuchaz/enigma/TokenChecker.java b/test/cuchaz/enigma/TokenChecker.java
new file mode 100644
index 00000000..07ab9eca
--- /dev/null
+++ b/test/cuchaz/enigma/TokenChecker.java
@@ -0,0 +1,71 @@
1/*******************************************************************************
2 * Copyright (c) 2014 Jeff Martin.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the GNU Public License v3.0
5 * which accompanies this distribution, and is available at
6 * http://www.gnu.org/licenses/gpl.html
7 *
8 * Contributors:
9 * Jeff Martin - initial API and implementation
10 ******************************************************************************/
11package cuchaz.enigma;
12
13import java.io.File;
14import java.io.IOException;
15import java.util.Collection;
16import java.util.List;
17
18import com.beust.jcommander.internal.Lists;
19import com.strobel.decompiler.languages.java.ast.CompilationUnit;
20
21import cuchaz.enigma.analysis.EntryReference;
22import cuchaz.enigma.analysis.SourceIndex;
23import cuchaz.enigma.analysis.Token;
24import cuchaz.enigma.analysis.TreeDumpVisitor;
25import cuchaz.enigma.mapping.Entry;
26
27public class TokenChecker
28{
29 private Deobfuscator m_deobfuscator;
30
31 protected TokenChecker( File jarFile )
32 throws IOException
33 {
34 m_deobfuscator = new Deobfuscator( jarFile );
35 }
36
37 protected String getDeclarationToken( Entry entry )
38 {
39 // decompile the class
40 CompilationUnit tree = m_deobfuscator.getSourceTree( entry.getClassName() );
41 // DEBUG
42 //tree.acceptVisitor( new TreeDumpVisitor( new File( "tree." + entry.getClassName().replace( '/', '.' ) + ".txt" ) ), null );
43 String source = m_deobfuscator.getSource( tree );
44 SourceIndex index = m_deobfuscator.getSourceIndex( tree, source );
45
46 // get the token value
47 Token token = index.getDeclarationToken( entry );
48 if( token == null )
49 {
50 return null;
51 }
52 return source.substring( token.start, token.end );
53 }
54
55 @SuppressWarnings( "unchecked" )
56 protected Collection<String> getReferenceTokens( EntryReference<? extends Entry,? extends Entry> reference )
57 {
58 // decompile the class
59 CompilationUnit tree = m_deobfuscator.getSourceTree( reference.context.getClassName() );
60 String source = m_deobfuscator.getSource( tree );
61 SourceIndex index = m_deobfuscator.getSourceIndex( tree, source );
62
63 // get the token values
64 List<String> values = Lists.newArrayList();
65 for( Token token : index.getReferenceTokens( (EntryReference<Entry,Entry>)reference ) )
66 {
67 values.add( source.substring( token.start, token.end ) );
68 }
69 return values;
70 }
71}
diff --git a/test/cuchaz/enigma/inputs/constructors/Caller.java b/test/cuchaz/enigma/inputs/constructors/Caller.java
index f356b1b3..b2186198 100644
--- a/test/cuchaz/enigma/inputs/constructors/Caller.java
+++ b/test/cuchaz/enigma/inputs/constructors/Caller.java
@@ -20,28 +20,35 @@ public class Caller
20 // c()V 20 // c()V
21 public void callSubDefault( ) 21 public void callSubDefault( )
22 { 22 {
23 // none/c.<init>()V 23 // none/d.<init>()V
24 System.out.println( new SubClass() ); 24 System.out.println( new SubClass() );
25 } 25 }
26 26
27 // d()V 27 // d()V
28 public void callSubInt( ) 28 public void callSubInt( )
29 { 29 {
30 // none/c.<init>(I)V 30 // none/d.<init>(I)V
31 System.out.println( new SubClass( 6 ) ); 31 System.out.println( new SubClass( 6 ) );
32 } 32 }
33 33
34 // e()V 34 // e()V
35 public void callSubIntInt( ) 35 public void callSubIntInt( )
36 { 36 {
37 // none/c.<init>(II)V 37 // none/d.<init>(II)V
38 System.out.println( new SubClass( 4, 2 ) ); 38 System.out.println( new SubClass( 4, 2 ) );
39 } 39 }
40 40
41 // f()V 41 // f()V
42 public void callSubSubInt( ) 42 public void callSubSubInt( )
43 { 43 {
44 // none/d.<init>(I)V 44 // none/e.<init>(I)V
45 System.out.println( new SubSubClass( 3 ) ); 45 System.out.println( new SubSubClass( 3 ) );
46 } 46 }
47
48 // g()V
49 public void callDefaultConstructable()
50 {
51 // none/c.<init>()V
52 System.out.println( new DefaultConstructable() );
53 }
47} 54}
diff --git a/test/cuchaz/enigma/inputs/constructors/DefaultConstructable.java b/test/cuchaz/enigma/inputs/constructors/DefaultConstructable.java
new file mode 100644
index 00000000..6cfd35e6
--- /dev/null
+++ b/test/cuchaz/enigma/inputs/constructors/DefaultConstructable.java
@@ -0,0 +1,6 @@
1package cuchaz.enigma.inputs.constructors;
2
3public class DefaultConstructable
4{
5 // only default constructor
6}
diff --git a/test/cuchaz/enigma/inputs/constructors/SubClass.java b/test/cuchaz/enigma/inputs/constructors/SubClass.java
index 2235de37..6ef77323 100644
--- a/test/cuchaz/enigma/inputs/constructors/SubClass.java
+++ b/test/cuchaz/enigma/inputs/constructors/SubClass.java
@@ -1,6 +1,6 @@
1package cuchaz.enigma.inputs.constructors; 1package cuchaz.enigma.inputs.constructors;
2 2
3// none/c extends none/a 3// none/d extends none/a
4public class SubClass extends BaseClass 4public class SubClass extends BaseClass
5{ 5{
6 // <init>()V 6 // <init>()V
@@ -24,6 +24,7 @@ public class SubClass extends BaseClass
24 this( a + b ); 24 this( a + b );
25 } 25 }
26 26
27 // <init>(III)V
27 public SubClass( int a, int b, int c ) 28 public SubClass( int a, int b, int c )
28 { 29 {
29 // none/a.<init>()V 30 // none/a.<init>()V
diff --git a/test/cuchaz/enigma/inputs/constructors/SubSubClass.java b/test/cuchaz/enigma/inputs/constructors/SubSubClass.java
index a9445d8b..76a0f1f3 100644
--- a/test/cuchaz/enigma/inputs/constructors/SubSubClass.java
+++ b/test/cuchaz/enigma/inputs/constructors/SubSubClass.java
@@ -1,6 +1,6 @@
1package cuchaz.enigma.inputs.constructors; 1package cuchaz.enigma.inputs.constructors;
2 2
3// none/d extends none/c 3// none/e extends none/d
4public class SubSubClass extends SubClass 4public class SubSubClass extends SubClass
5{ 5{
6 // <init>(I)V 6 // <init>(I)V