File tree Expand file tree Collapse file tree 1 file changed +15
-4
lines changed
codemodel/src/main/java/com/sun/codemodel Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change 4040
4141package com .sun .codemodel ;
4242
43+ import com .sun .org .apache .xml .internal .security .encryption .ReferenceList ;
44+
4345import java .io .PrintWriter ;
4446import java .io .Writer ;
4547import java .util .ArrayList ;
@@ -473,17 +475,26 @@ private boolean supressImport(JClass clazz, JClass c) {
473475 if (packageName .equals ("java.lang" ))
474476 return true ; // no need to explicitly import java.lang classes
475477
476- if (clazz ._package () == c ._package ()){
478+ if (clazz ._package () == c ._package ()) {
477479 // inner classes require an import stmt.
478480 // All other pkg local classes do not need an
479481 // import stmt for ref.
480- if (clazz .outer ()==null ) {
481- return true ; // no need to explicitly import a class into itself
482- }
482+ // no need to explicitly import a class into itself
483+ return clazz .outer () == null || isInnerClass (clazz , c );
483484 }
484485 return false ;
485486 }
486487
488+ private boolean isInnerClass (JClass clazz , JClass c ){
489+ if (clazz .outer () == null ){
490+ return false ;
491+ }
492+ else if (clazz .outer ().equals (c )){
493+ return true ;
494+ }
495+ return isInnerClass (clazz .outer (), c );
496+ }
497+
487498 private JPackage javaLang ;
488499
489500
You can’t perform that action at this time.
0 commit comments