< prev index next >

src/jdk.compiler/share/classes/com/sun/tools/javac/code/ClassFinder.java

Print this page
rev 3947 : imported patch xmodule-to-patch-module


 536     // and (deliberately) does not default sourcepath to classpath.
 537     // But, we need to think about retaining existing behavior for
 538     // -classpath and -sourcepath for single module mode.
 539     // One plausible solution is to detect if the module's sourceLocation
 540     // is the same as the module's classLocation.
 541     private void scanModulePaths(PackageSymbol p, ModuleSymbol msym) throws IOException {
 542         Set<JavaFileObject.Kind> kinds = getPackageFileKinds();
 543 
 544         Set<JavaFileObject.Kind> classKinds = EnumSet.copyOf(kinds);
 545         classKinds.remove(JavaFileObject.Kind.SOURCE);
 546         boolean wantClassFiles = !classKinds.isEmpty();
 547 
 548         Set<JavaFileObject.Kind> sourceKinds = EnumSet.copyOf(kinds);
 549         sourceKinds.remove(JavaFileObject.Kind.CLASS);
 550         boolean wantSourceFiles = !sourceKinds.isEmpty();
 551 
 552         String packageName = p.fullname.toString();
 553 
 554         Location classLocn = msym.classLocation;
 555         Location sourceLocn = msym.sourceLocation;

 556 















 557         if (wantClassFiles && (classLocn != null)) {
 558             fillIn(p, classLocn,
 559                    list(classLocn,
 560                         p,
 561                         packageName,
 562                         classKinds));
 563         }
 564         if (wantSourceFiles && (sourceLocn != null)) {
 565             fillIn(p, sourceLocn,
 566                    list(sourceLocn,
 567                         p,
 568                         packageName,
 569                         sourceKinds));



 570         }
 571     }
 572 
 573     /**
 574      * Scans class path and source path for files in given package.
 575      */
 576     private void scanUserPaths(PackageSymbol p, boolean includeSourcePath) throws IOException {
 577         Set<JavaFileObject.Kind> kinds = getPackageFileKinds();
 578 
 579         Set<JavaFileObject.Kind> classKinds = EnumSet.copyOf(kinds);
 580         classKinds.remove(JavaFileObject.Kind.SOURCE);
 581         boolean wantClassFiles = !classKinds.isEmpty();
 582 
 583         Set<JavaFileObject.Kind> sourceKinds = EnumSet.copyOf(kinds);
 584         sourceKinds.remove(JavaFileObject.Kind.CLASS);
 585         boolean wantSourceFiles = !sourceKinds.isEmpty();
 586 
 587         boolean haveSourcePath = includeSourcePath && fileManager.hasLocation(SOURCE_PATH);
 588 
 589         if (verbose && verbosePath) {




 536     // and (deliberately) does not default sourcepath to classpath.
 537     // But, we need to think about retaining existing behavior for
 538     // -classpath and -sourcepath for single module mode.
 539     // One plausible solution is to detect if the module's sourceLocation
 540     // is the same as the module's classLocation.
 541     private void scanModulePaths(PackageSymbol p, ModuleSymbol msym) throws IOException {
 542         Set<JavaFileObject.Kind> kinds = getPackageFileKinds();
 543 
 544         Set<JavaFileObject.Kind> classKinds = EnumSet.copyOf(kinds);
 545         classKinds.remove(JavaFileObject.Kind.SOURCE);
 546         boolean wantClassFiles = !classKinds.isEmpty();
 547 
 548         Set<JavaFileObject.Kind> sourceKinds = EnumSet.copyOf(kinds);
 549         sourceKinds.remove(JavaFileObject.Kind.CLASS);
 550         boolean wantSourceFiles = !sourceKinds.isEmpty();
 551 
 552         String packageName = p.fullname.toString();
 553 
 554         Location classLocn = msym.classLocation;
 555         Location sourceLocn = msym.sourceLocation;
 556         Location patchLocn = msym.patchLocation;
 557 
 558         boolean prevPreferCurrent = preferCurrent;
 559 
 560         try {
 561             preferCurrent = false;
 562             if ((wantClassFiles || wantSourceFiles) && (patchLocn != null)) {
 563                 Set<JavaFileObject.Kind> combined = EnumSet.noneOf(JavaFileObject.Kind.class);
 564                 combined.addAll(classKinds);
 565                 combined.addAll(sourceKinds);
 566                 fillIn(p, patchLocn,
 567                        list(patchLocn,
 568                             p,
 569                             packageName,
 570                             combined));
 571             }
 572             preferCurrent = true;
 573             if (wantClassFiles && (classLocn != null)) {
 574                 fillIn(p, classLocn,
 575                        list(classLocn,
 576                             p,
 577                             packageName,
 578                             classKinds));
 579             }
 580             if (wantSourceFiles && (sourceLocn != null)) {
 581                 fillIn(p, sourceLocn,
 582                        list(sourceLocn,
 583                             p,
 584                             packageName,
 585                             sourceKinds));
 586             }
 587         } finally {
 588             preferCurrent = prevPreferCurrent;
 589         }
 590     }
 591 
 592     /**
 593      * Scans class path and source path for files in given package.
 594      */
 595     private void scanUserPaths(PackageSymbol p, boolean includeSourcePath) throws IOException {
 596         Set<JavaFileObject.Kind> kinds = getPackageFileKinds();
 597 
 598         Set<JavaFileObject.Kind> classKinds = EnumSet.copyOf(kinds);
 599         classKinds.remove(JavaFileObject.Kind.SOURCE);
 600         boolean wantClassFiles = !classKinds.isEmpty();
 601 
 602         Set<JavaFileObject.Kind> sourceKinds = EnumSet.copyOf(kinds);
 603         sourceKinds.remove(JavaFileObject.Kind.CLASS);
 604         boolean wantSourceFiles = !sourceKinds.isEmpty();
 605 
 606         boolean haveSourcePath = includeSourcePath && fileManager.hasLocation(SOURCE_PATH);
 607 
 608         if (verbose && verbosePath) {


< prev index next >