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) { 590 if (fileManager instanceof StandardJavaFileManager) { | 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 Location patchOutLocn = msym.patchOutputLocation; 558 559 boolean prevPreferCurrent = preferCurrent; 560 561 try { 562 preferCurrent = false; 563 if (wantClassFiles && (patchOutLocn != null)) { 564 fillIn(p, patchOutLocn, 565 list(patchOutLocn, 566 p, 567 packageName, 568 classKinds)); 569 } 570 if ((wantClassFiles || wantSourceFiles) && (patchLocn != null)) { 571 Set<JavaFileObject.Kind> combined = EnumSet.noneOf(JavaFileObject.Kind.class); 572 combined.addAll(classKinds); 573 combined.addAll(sourceKinds); 574 fillIn(p, patchLocn, 575 list(patchLocn, 576 p, 577 packageName, 578 combined)); 579 } 580 preferCurrent = true; 581 if (wantClassFiles && (classLocn != null)) { 582 fillIn(p, classLocn, 583 list(classLocn, 584 p, 585 packageName, 586 classKinds)); 587 } 588 if (wantSourceFiles && (sourceLocn != null)) { 589 fillIn(p, sourceLocn, 590 list(sourceLocn, 591 p, 592 packageName, 593 sourceKinds)); 594 } 595 } finally { 596 preferCurrent = prevPreferCurrent; 597 } 598 } 599 600 /** 601 * Scans class path and source path for files in given package. 602 */ 603 private void scanUserPaths(PackageSymbol p, boolean includeSourcePath) throws IOException { 604 Set<JavaFileObject.Kind> kinds = getPackageFileKinds(); 605 606 Set<JavaFileObject.Kind> classKinds = EnumSet.copyOf(kinds); 607 classKinds.remove(JavaFileObject.Kind.SOURCE); 608 boolean wantClassFiles = !classKinds.isEmpty(); 609 610 Set<JavaFileObject.Kind> sourceKinds = EnumSet.copyOf(kinds); 611 sourceKinds.remove(JavaFileObject.Kind.CLASS); 612 boolean wantSourceFiles = !sourceKinds.isEmpty(); 613 614 boolean haveSourcePath = includeSourcePath && fileManager.hasLocation(SOURCE_PATH); 615 616 if (verbose && verbosePath) { 617 if (fileManager instanceof StandardJavaFileManager) { |