Skip to content

Commit

Permalink
Remove wrong validation error about forbidden import of java.* packages
Browse files Browse the repository at this point in the history
java.* packages are not forbidden to import (with modular JDKs one is
even encouraged to list java.* packages).
Even though this error only showed up if any imported package could not
be resolved, but since it is (now) perfectly fine to import them as
well, there should not be a special error message for that case.
This could even cause a false positive if another package is not
resolved.
  • Loading branch information
HannesWell committed Aug 10, 2023
1 parent d7228a1 commit 4e819ea
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,6 @@ public class PDECoreMessages extends NLS {

public static String BundleErrorReporter_exportNoJRE;

public static String BundleErrorReporter_importNoJRE;

public static String ManifestConsistencyChecker_0;

public static String ManifestConsistencyChecker_buildDoesNotExist;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1206,19 +1206,10 @@ private void validateImportPackage(IProgressMonitor monitor) {
int length = element.getValueComponents().length;
for (int j = 0; j < length; j++) {
ImportPackageSpecification importSpec = imports[index++];
String name = importSpec.getName();
if (name.equals("java") || name.startsWith("java.")) { //$NON-NLS-1$ //$NON-NLS-2$
IHeader jreHeader = getHeader(ICoreConstants.ECLIPSE_JREBUNDLE);
if (jreHeader == null || !"true".equals(jreHeader.getValue())) { //$NON-NLS-1$
report(PDECoreMessages.BundleErrorReporter_importNoJRE, getPackageLine(header, element), CompilerFlags.ERROR, PDEMarkerFactory.M_JAVA_PACKAGE__PORTED, PDEMarkerFactory.CAT_FATAL);
continue;
}
}

if (importSpec.isResolved() || !isCheckUnresolvedImports()) {
continue;
}

String name = importSpec.getName();
boolean optional = isOptional(element);
int severity = getRequireBundleSeverity(element, optional);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ BundleErrorReporter_NotExistPDE=Bundle ''{0}'' cannot be resolved
BundleErrorReporter_EmptyTargetPlatform=Target Platform is not set
BundleErrorReporter_ExecEnv_tooLow=Execution environment is lower than one of the plug-in''s dependencies ({1}) which has an execution environment of {0}.
BundleErrorReporter_exportNoJRE=Cannot export packages prefixed with 'java'
BundleErrorReporter_importNoJRE=Cannot import packages prefixed with 'java'
BundleErrorReporter_HostNotExistPDE=Host bundle ''{0}'' cannot be resolved
BundleErrorReporter_HostNeeded=Fragment-Host must be defined for this fragment
BundleErrorReporter_PackageNotExported=No available bundle exports package ''{0}''
Expand Down

0 comments on commit 4e819ea

Please sign in to comment.