Alexandru-Constantin Bledea 9 years ago committed by Roman Shevchenko
parent ee740aa056
commit 766fc1390d
  1. 3
      src/org/jetbrains/java/decompiler/main/collectors/ImportCollector.java
  2. 1
      test/org/jetbrains/java/decompiler/SingleClassesTest.java
  3. BIN
      testData/classes/ext/Shadow$B.class
  4. BIN
      testData/classes/ext/Shadow.class
  5. BIN
      testData/classes/pkg/Shadow.class
  6. BIN
      testData/classes/pkg/TestShadowing.class
  7. 6
      testData/results/TestShadowing.dec
  8. 6
      testData/src/ext/Shadow.java
  9. 4
      testData/src/pkg/Shadow.java
  10. 5
      testData/src/pkg/TestShadowing.java

@ -99,7 +99,8 @@ public class ImportCollector {
if (existsDefaultClass || if (existsDefaultClass ||
(mapSimpleNames.containsKey(nshort) && !npackage.equals(mapSimpleNames.get(nshort)))) { (mapSimpleNames.containsKey(nshort) && !npackage.equals(mapSimpleNames.get(nshort)))) {
return fullname; // don't return full name because if the class is a inner class, full name refers to the parent full name, not the child full name
return retname == null ? fullname : (npackage + "." + retname);
} }
else if (!mapSimpleNames.containsKey(nshort)) { else if (!mapSimpleNames.containsKey(nshort)) {
mapSimpleNames.put(nshort, npackage); mapSimpleNames.put(nshort, npackage);

@ -61,4 +61,5 @@ public class SingleClassesTest extends SingleClassesTestBase {
@Test public void testInnerLocalPkg() { doTest("pkg/TestInnerLocalPkg"); } @Test public void testInnerLocalPkg() { doTest("pkg/TestInnerLocalPkg"); }
@Test public void testInnerSignature() { doTest("pkg/TestInnerSignature"); } @Test public void testInnerSignature() { doTest("pkg/TestInnerSignature"); }
@Test public void testParameterizedTypes() { doTest("pkg/TestParameterizedTypes"); } @Test public void testParameterizedTypes() { doTest("pkg/TestParameterizedTypes"); }
@Test public void testShadowing() { doTest("pkg/TestShadowing", "pkg/Shadow", "ext/Shadow"); }
} }

Binary file not shown.

Binary file not shown.

@ -0,0 +1,6 @@
package pkg;
class TestShadowing {
ext.Shadow.B instanceOfB = new ext.Shadow.B();
}

@ -0,0 +1,6 @@
package ext;
// companion class for pkg/TestShadowing.java
public class Shadow {
public static class B { }
}

@ -0,0 +1,4 @@
package pkg;
// companion class for pkg/TestShadowing.java
public class Shadow { }

@ -0,0 +1,5 @@
package pkg;
class TestShadowing {
ext.Shadow.B instanceOfB = new ext.Shadow.B();
}
Loading…
Cancel
Save