From 8e177eefdcc4a7eeaf0c53179991ab38781638f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Kubitz?= Date: Wed, 5 Jun 2024 13:41:42 +0200 Subject: [PATCH] fix NPE for ReferenceAnalyzer.fIndexedDetectors null #1289 https://github.com/eclipse-pde/eclipse.pde/issues/1289 --- .../org.eclipse.pde.api.tools/META-INF/MANIFEST.MF | 2 +- .../tools/internal/builder/ReferenceAnalyzer.java | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/apitools/org.eclipse.pde.api.tools/META-INF/MANIFEST.MF b/apitools/org.eclipse.pde.api.tools/META-INF/MANIFEST.MF index 54823e558e..5b16e91f8a 100644 --- a/apitools/org.eclipse.pde.api.tools/META-INF/MANIFEST.MF +++ b/apitools/org.eclipse.pde.api.tools/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.pde.api.tools;singleton:=true -Bundle-Version: 1.3.400.qualifier +Bundle-Version: 1.3.500.qualifier Bundle-Vendor: %providerName Bundle-Localization: plugin Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.29.0,4.0.0)", diff --git a/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/builder/ReferenceAnalyzer.java b/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/builder/ReferenceAnalyzer.java index febb713c0d..ac7d0ab41f 100644 --- a/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/builder/ReferenceAnalyzer.java +++ b/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/builder/ReferenceAnalyzer.java @@ -146,7 +146,7 @@ public void visit(String packageName, IApiTypeRoot classFile) { * are interested in. Provides a fast way to hand references off to * interested problem detectors. */ - IApiProblemDetector[][] fIndexedDetectors; + private IApiProblemDetector[][] fIndexedDetectors; /** * Indexes the problem detectors by the reference kinds they are interested @@ -230,10 +230,14 @@ void extractReferences(IApiTypeContainer scope, IProgressMonitor monitor) throws */ public IApiProblem[] analyze(IApiComponent component, IApiTypeContainer scope, IProgressMonitor monitor) throws CoreException { SubMonitor localMonitor = SubMonitor.convert(monitor, 4); - // build problem detectors - IApiProblemDetector[] detectors = buildProblemDetectors(component, ProblemDetectorBuilder.K_ALL, localMonitor.split(1)); - // analyze try { + // build problem detectors + IApiProblemDetector[] detectors = buildProblemDetectors(component, ProblemDetectorBuilder.K_ALL, + localMonitor.split(1)); + if (detectors.length == 0) { + return EMPTY_RESULT; + } + // analyze // 1. extract references localMonitor.subTask(BuilderMessages.ReferenceAnalyzer_analyzing_api_checking_use); extractReferences(scope, localMonitor.split(1));