Bug 578150 - Error in API builder: "invalid version "JavaSE-14": non-numeric"
Summary: Error in API builder: "invalid version "JavaSE-14": non-numeric"
Status: RESOLVED FIXED
Alias: None
Product: PDE
Classification: Eclipse Project
Component: API Tools (show other bugs)
Version: 4.22   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 4.23 M2   Edit
Assignee: Vikas Chandra CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-01-11 02:57 EST by Andrey Loskutov CLA
Modified: 2022-01-18 02:23 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrey Loskutov CLA 2022-01-11 02:57:45 EST
No idea where this is coming from, I saw this once on startup and haven't seen this on a next restart, using same workspace / baseline / code state.

eclipse.buildId=4.23.0.I20220110-1800
java.version=11.0.10
java.vendor=Red Hat, Inc.
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
Command-line arguments:  -data /data/4x_platform_workspace -os linux -ws gtk -arch x86_64

org.eclipse.core.jobs
Error
Tue Jan 11 08:52:42 CET 2022
An internal error occurred during: "API Analysis Builder".

java.lang.IllegalArgumentException: invalid version "JavaSE-14": non-numeric "JavaSE-14"
	at org.osgi.framework.Version.parseInt(Version.java:169)
	at org.osgi.framework.Version.<init>(Version.java:126)
	at org.eclipse.pde.api.tools.internal.model.ApiBaseline.lambda$0(ApiBaseline.java:400)
	at java.base/java.util.TreeMap.compare(TreeMap.java:1292)
	at java.base/java.util.TreeMap.put(TreeMap.java:536)
	at java.base/java.util.TreeSet.add(TreeSet.java:255)
	at org.eclipse.pde.api.tools.internal.model.ApiBaseline.addComponent(ApiBaseline.java:401)
	at org.eclipse.pde.api.tools.internal.model.ApiBaseline.initialize(ApiBaseline.java:357)
	at org.eclipse.pde.api.tools.internal.model.ApiBaseline.initialize(ApiBaseline.java:234)
	at org.eclipse.pde.api.tools.internal.model.ApiBaseline.resolveSystemLibrary(ApiBaseline.java:491)
	at org.eclipse.pde.api.tools.internal.model.ApiBaseline.addApiComponents(ApiBaseline.java:430)
	at org.eclipse.pde.api.tools.internal.ApiBaselineManager.restoreBaseline(ApiBaselineManager.java:475)
	at org.eclipse.pde.api.tools.internal.ApiBaselineManager.loadBaselineInfos(ApiBaselineManager.java:235)
	at org.eclipse.pde.api.tools.internal.model.ApiBaseline.loadBaselineInfos(ApiBaseline.java:739)
	at org.eclipse.pde.api.tools.internal.model.ApiBaseline.getApiComponent(ApiBaseline.java:706)
	at org.eclipse.pde.api.tools.internal.builder.BaseApiAnalyzer.checkBaselineMismatch(BaseApiAnalyzer.java:2646)
	at org.eclipse.pde.api.tools.internal.builder.ApiAnalysisBuilder.buildAll(ApiAnalysisBuilder.java:891)
	at org.eclipse.pde.api.tools.internal.builder.ApiAnalysisBuilder.work(ApiAnalysisBuilder.java:432)
	at org.eclipse.pde.api.tools.internal.builder.ApiAnalysisBuilder$ApiAnalysisJob.run(ApiAnalysisBuilder.java:578)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Caused by: java.lang.NumberFormatException: For input string: "JavaSE-14"
	at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
	at java.base/java.lang.Integer.parseInt(Integer.java:652)
	at java.base/java.lang.Integer.parseInt(Integer.java:770)
	at org.osgi.framework.Version.parseInt(Version.java:167)
	... 19 more
Comment 1 Vikas Chandra CLA 2022-01-11 03:38:50 EST
I am unable to put a breakpoint ( double click on editor ruler) at line number 400. Is this expected?
Comment 2 Andrey Loskutov CLA 2022-01-11 03:48:58 EST
(In reply to Vikas Chandra from comment #1)
> I am unable to put a breakpoint ( double click on editor ruler) at line
> number 400. Is this expected?

Yes. I think this is what is planned to be done by Sarika - breakpoints for single line lambdas.
Comment 3 Vikas Chandra CLA 2022-01-11 04:16:01 EST
I changed JRE ( trying to recreate this) and I got this below



!STACK 1
org.eclipse.core.internal.resources.ResourceException(/org.eclipse.jdt.core/bin/org/eclipse/jdt/core/IMethod.class)[368]: java.lang.Exception: File not found: /home/vikas/git/eclipse.jdt.core_MASTER2021/org.eclipse.jdt.core/bin/org/eclipse/jdt/core/IMethod.class.
	at org.eclipse.core.internal.resources.ResourceException.provideStackTrace(ResourceException.java:42)
	at org.eclipse.core.internal.resources.ResourceException.<init>(ResourceException.java:38)
	at org.eclipse.core.internal.localstore.FileSystemResourceManager.read(FileSystemResourceManager.java:835)
	at org.eclipse.core.internal.resources.File.getContents(File.java:275)
	at org.eclipse.pde.api.tools.internal.model.ResourceApiTypeRoot.getContents(ResourceApiTypeRoot.java:62)
	at org.eclipse.pde.api.tools.internal.model.AbstractApiTypeRoot.getStructure(AbstractApiTypeRoot.java:62)
	at org.eclipse.pde.api.tools.internal.provisional.comparator.ApiComparator$2.visit(ApiComparator.java:747)
	at org.eclipse.pde.api.tools.internal.model.ArchiveApiTypeContainer.accept(ArchiveApiTypeContainer.java:198)
	at org.eclipse.pde.api.tools.internal.provisional.comparator.ApiComparator.internalCompare(ApiComparator.java:659)
Comment 4 Andrey Loskutov CLA 2022-01-12 04:19:50 EST
New SDK build, same workspace, nothing changed in any settings. After 2 starts I've got this on startup (note the different name now):

eclipse.buildId=4.23.0.I20220112-0210
java.version=11.0.10
java.vendor=Red Hat, Inc.
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
Command-line arguments:  -data file:/data/4x_platform_workspace/ -os linux -ws gtk -arch x86_64

org.eclipse.core.jobs
Error
Wed Jan 12 10:11:06 CET 2022
An internal error occurred during: "API Analysis Builder".

java.lang.IllegalArgumentException: invalid version "JavaSE-1.8": non-numeric "JavaSE-1"
	at org.osgi.framework.Version.parseInt(Version.java:169)
	at org.osgi.framework.Version.<init>(Version.java:126)
	at org.eclipse.pde.api.tools.internal.model.ApiBaseline.lambda$0(ApiBaseline.java:400)
	at java.base/java.util.TreeMap.compare(TreeMap.java:1292)
	at java.base/java.util.TreeMap.put(TreeMap.java:536)
	at java.base/java.util.TreeSet.add(TreeSet.java:255)
	at org.eclipse.pde.api.tools.internal.model.ApiBaseline.addComponent(ApiBaseline.java:401)
	at org.eclipse.pde.api.tools.internal.model.ApiBaseline.initialize(ApiBaseline.java:357)
	at org.eclipse.pde.api.tools.internal.model.ApiBaseline.initialize(ApiBaseline.java:234)
	at org.eclipse.pde.api.tools.internal.model.ApiBaseline.resolveSystemLibrary(ApiBaseline.java:491)
	at org.eclipse.pde.api.tools.internal.model.ApiBaseline.addApiComponents(ApiBaseline.java:430)
	at org.eclipse.pde.api.tools.internal.ApiBaselineManager.restoreBaseline(ApiBaselineManager.java:475)
	at org.eclipse.pde.api.tools.internal.ApiBaselineManager.loadBaselineInfos(ApiBaselineManager.java:235)
	at org.eclipse.pde.api.tools.internal.model.ApiBaseline.loadBaselineInfos(ApiBaseline.java:739)
	at org.eclipse.pde.api.tools.internal.model.ApiBaseline.getApiComponent(ApiBaseline.java:706)
	at org.eclipse.pde.api.tools.internal.builder.BaseApiAnalyzer.checkBaselineMismatch(BaseApiAnalyzer.java:2646)
	at org.eclipse.pde.api.tools.internal.builder.ApiAnalysisBuilder.buildAll(ApiAnalysisBuilder.java:891)
	at org.eclipse.pde.api.tools.internal.builder.ApiAnalysisBuilder.work(ApiAnalysisBuilder.java:432)
	at org.eclipse.pde.api.tools.internal.builder.ApiAnalysisBuilder$ApiAnalysisJob.run(ApiAnalysisBuilder.java:578)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Caused by: java.lang.NumberFormatException: For input string: "JavaSE-1"
	at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
	at java.base/java.lang.Integer.parseInt(Integer.java:652)
	at java.base/java.lang.Integer.parseInt(Integer.java:770)
	at org.osgi.framework.Version.parseInt(Version.java:167)
	... 19 more
Comment 5 Vikas Chandra CLA 2022-01-12 04:32:15 EST
Is the new option 'Run API Analysis as job" checked?
Comment 6 Sarika Sinha CLA 2022-01-12 07:03:41 EST
Faced the same problem after checking 'Run API Analysis as job" and restart of workspace.
Comment 7 Andrey Loskutov CLA 2022-01-12 07:24:24 EST
(In reply to Vikas Chandra from comment #5)
> Is the new option 'Run API Analysis as job" checked?

Yes. Looks like a startup / initialization issue in PDE that is timing dependent, revealed by the job.

Or some PDE internal data structure init needs to run *while holding the workspace lock* - now because the job is decoupled from workspace build something runs in parallel?
Comment 8 Sarika Sinha CLA 2022-01-12 08:26:54 EST
(In reply to Sarika Sinha from comment #6)
> Faced the same problem after checking 'Run API Analysis as job" and restart
> of workspace.

I can recreate every time but only if I import Git from a different install before restart.
Comment 9 Andrey Loskutov CLA 2022-01-12 08:32:24 EST
(In reply to Sarika Sinha from comment #8)
> but only if I import Git from a different install

What do you mean by that? Could you please provide steps?
Comment 10 Eclipse Genie CLA 2022-01-12 08:46:46 EST
New Gerrit change created: https://git.eclipse.org/r/c/pde/eclipse.pde.ui/+/189539
Comment 11 Vikas Chandra CLA 2022-01-12 08:56:40 EST
This could happen if there are multiple JRE locations for the same java version. Not sure why this comes previously but for SystemAPILibraryComponent, we can have just check if the version strings are equal and return 0.

Since systemlibrary's symbolic name
public String getSymbolicName() {
		return fExecEnv[0];
	}

and version is same
	@Override
	public String getVersion() {
		return fVersion;
	}

	private void init(ExecutionEnvironmentDescription description) {
		fLibraries = description.getLibraryLocations();
		fExecEnv = new String[] { description.getProperty(ExecutionEnvironmentDescription.CLASS_LIB_LEVEL) };
		fVersion = fExecEnv[0];

it will always be equal and compare can return 0
Comment 12 Sarika Sinha CLA 2022-01-12 10:51:20 EST
(In reply to Andrey Loskutov from comment #9)
> (In reply to Sarika Sinha from comment #8)
> > but only if I import Git from a different install
> 
> What do you mean by that? Could you please provide steps?

Steps :
1. Start the Eclipse in the older workspace where I have JDT and Platform repos
2. Check the "Run API Analysis as job" option
3. Import/Install EGit plugin ( I generally take it from a different build where I had it installed)
4. Completion of install asks for restart
5. On the restart, API Builder kicks in and Error dialog pops in


I tried skipping step 3 but could not recreate the problem. 
I have many JREs in the "Installed JREs" but all points to distinct Java path.
Comment 13 Sarika Sinha CLA 2022-01-13 07:03:50 EST
Could not reproduce with I20220112-1800
Comment 14 Andrey Loskutov CLA 2022-01-13 07:30:45 EST
(In reply to Sarika Sinha from comment #13)
> Could not reproduce with I20220112-1800

I saw this once again, unfortunately, but couldn't enforce.
Comment 15 Vikas Chandra CLA 2022-01-15 04:47:33 EST
(In reply to Sarika Sinha from comment #12)
> (In reply to Andrey Loskutov from comment #9)
> > (In reply to Sarika Sinha from comment #8)
> > > but only if I import Git from a different install
> > 
> > What do you mean by that? Could you please provide steps?
> 
> Steps :
> 1. Start the Eclipse in the older workspace where I have JDT and Platform
> repos
> 2. Check the "Run API Analysis as job" option
> 3. Import/Install EGit plugin ( I generally take it from a different build
> where I had it installed)
> 4. Completion of install asks for restart
> 5. On the restart, API Builder kicks in and Error dialog pops in
> 
> 
> I tried skipping step 3 but could not recreate the problem. 
> I have many JREs in the "Installed JREs" but all points to distinct Java
> path.

I got the below with the same steps. ( with Build id: I20220114-1800)

java.lang.IllegalStateException
	at org.eclipse.jdt.core.dom.ASTParser.internalCreateAST(ASTParser.java:1182)
	at org.eclipse.jdt.core.dom.ASTParser.createAST(ASTParser.java:868)
	at org.eclipse.jdt.core.manipulation.CoreASTProvider$1.run(CoreASTProvider.java:272)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
	at org.eclipse.jdt.core.manipulation.CoreASTProvider.createAST(CoreASTProvider.java:264)
	at org.eclipse.jdt.core.manipulation.CoreASTProvider.getAST(CoreASTProvider.java:197)
	at org.eclipse.jdt.core.manipulation.SharedASTProviderCore.getAST(SharedASTProviderCore.java:138)
	at org.eclipse.jdt.internal.ui.javaeditor.ClassFileEditor$1.run(ClassFileEditor.java:713)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Comment 17 Vikas Chandra CLA 2022-01-15 07:24:26 EST
I was never able to recreate this with any of the builds on Linux as well as windows.

However I added a safety check and a log info

In the error log, please look for 

"Multiple locations for the same Java"

That should also print 2 locations along with it.
Comment 18 Vikas Chandra CLA 2022-01-15 07:25:37 EST
The internal error should not happen now. Instead we may see some logging info to take this further.
Comment 19 Vikas Chandra CLA 2022-01-18 02:04:01 EST
Please look for "Multiple locations for the same Java" in the error log. If you see it, please post on this bug.
Comment 20 Vikas Chandra CLA 2022-01-18 02:05:35 EST
I will mark this as resolved and if the log contains "Multiple locations for the same Java", I will investigate ( re-open if required)
Comment 21 Andrey Loskutov CLA 2022-01-18 02:23:06 EST
(In reply to Vikas Chandra from comment #19)
> Please look for "Multiple locations for the same Java" in the error log. If
> you see it, please post on this bug.

I haven't seen that anymore, also no new log entries. I believe this (abscence of errors) could be the positive side effect of bug 578204 changes.