Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion ui/org.eclipse.pde.junit.runtime/.classpath
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-9">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this stay at 1.8 or does it have to be the highest version of all contained source folders?
I assume the general jdt.core settings (with release option enabled) ensure that the main src folder isn't compiling against Java-9?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes the JVM is always the highest (as not more the one is supported).

The source/target controls for what byte-code version is used and the release control if the compiler checks what JVM classes can be used (I'm sure @stephan-herrmann can better explain this) so we still get what we want.

<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="src9">
<attributes>
<attribute name="release" value="9"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="bin"/>
</classpath>
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ org.eclipse.jdt.core.circularClasspath=error
org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
compilers.f.unresolved-features=1
compilers.f.unresolved-plugins=1
compilers.incompatible-environment=0
compilers.incompatible-environment=2
compilers.p.build=1
compilers.p.build.bin.includes=1
compilers.p.build.encodings=2
Expand All @@ -12,14 +12,18 @@ compilers.p.build.source.library=1
compilers.p.build.src.includes=1
compilers.p.deprecated=1
compilers.p.discouraged-class=1
compilers.p.exec-env-too-low=2
compilers.p.ignored-resource-protocols=
compilers.p.internal=1
compilers.p.matching-pom-version=0
compilers.p.missing-packages=0
compilers.p.missing-version-export-package=2
compilers.p.missing-version-import-package=2
compilers.p.missing-version-require-bundle=2
compilers.p.no-required-att=0
compilers.p.no.automatic.module=1
compilers.p.not-externalized-att=1
compilers.p.service.component.without.lazyactivation=1
compilers.p.unknown-attribute=1
compilers.p.unknown-class=1
compilers.p.unknown-element=1
Expand Down
1 change: 1 addition & 0 deletions ui/org.eclipse.pde.junit.runtime/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ Bundle-ActivationPolicy: lazy
Import-Package: org.eclipse.ui.testing;resolution:=optional
DynamicImport-Package: org.junit.platform.engine;version="[1.14.0,2.0.0)"
Automatic-Module-Name: org.eclipse.pde.junit.runtime
Multi-Release: true
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

/**
* Default implementation used with Java 1.8
* TODO provide MR variant using stack walker, currently blocked by JDT bug ...
*/
public class Caller {

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*******************************************************************************
* Copyright (c) 2025 Christoph Läubrich and others.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Christoph Läubrich - initial API and implementation
*
*/
package org.eclipse.pde.internal.junit.runtime;

import java.util.Objects;

import org.osgi.framework.Bundle;
import org.osgi.framework.FrameworkUtil;

/**
* Release specific implementation that using stack walker
*/
public class Caller {

private static final StackWalker WALKER = StackWalker.getInstance(StackWalker.Option.RETAIN_CLASS_REFERENCE);
private static final Bundle LOADER_BUNDLE = FrameworkUtil.getBundle(SPIBundleClassLoader.class);

static Bundle getBundle(int junitVersion) {
return WALKER.walk(stream -> stream.map(sf -> FrameworkUtil.getBundle(sf.getDeclaringClass())).filter(Objects::nonNull).filter(b -> b != LOADER_BUNDLE).findFirst().orElse(null));
}

}
Loading