@ Override public void reportPublicApi ( ClassSymbol sym ) { // The next test will catch when source files are located in the wrong directory! // This ought to be moved into javac as a new warning, or perhaps as part // of the auxiliary class warning. // For example if sun.swing.BeanInfoUtils // is in fact stored in: /mybuild/jdk/gensrc/javax/swing/beaninfo/BeanInfoUtils.java // We do not need to test that BeanInfoUtils is stored in a file named BeanInfoUtils // since this is checked earlier. if ( sym . sourcefile != null ) { // Rewrite sun.swing.BeanInfoUtils into /sun/swing/ StringBuilder pathb = new StringBuilder ( ) ; StringTokenizer qn = new StringTokenizer ( sym . packge ( ) . toString ( ) , "." ) ; boolean first = true ; while ( qn . hasMoreTokens ( ) ) { String o = qn . nextToken ( ) ; pathb . append ( "/" ) ; pathb . append ( o ) ; first = false ; } pathb . append ( "/" ) ; String path = pathb . toString ( ) ; // Now cut the uri to be: file:///mybuild/jdk/gensrc/javax/swing/beaninfo/ String p = sym . sourcefile . toUri ( ) . getPath ( ) ; // Do not use File.separatorChar here, a URI always uses slashes /. int i = p . lastIndexOf ( "/" ) ; String pp = p . substring ( 0 , i + 1 ) ; // Now check if the truncated uri ends with the path. (It does not == failure!) if ( path . length ( ) > 0 && ! path . equals ( "/unnamed package/" ) && ! pp . endsWith ( path ) ) { compilerThread . logError ( "Error: The source file " + sym . sourcefile . getName ( ) + " is located in the wrong package directory, because it contains the class " + sym . getQualifiedName ( ) ) ; } } deps . visitPubapi ( sym ) ; }
Collect the public apis of classes supplied explicitly for compilation .