Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ChartFactory.newChart is not API #264

Open
Mailaender opened this issue May 2, 2022 · 6 comments
Open

ChartFactory.newChart is not API #264

Mailaender opened this issue May 2, 2022 · 6 comments
Labels

Comments

@Mailaender
Copy link

Mailaender commented May 2, 2022

Describe the bug

When importing via @eclipse-m2e I get an error at this line

Chart chart = chartFactorySWT.newChart(quality);
Access restriction: The method 'ChartFactory.newChart(Quality)' is not API (restriction on required library '~/Eclipse/rcp-2022-03/eclipse/configuration/org.eclipse.osgi/291/data/f2c50ff5598514905948ed0f33983d582e6a69e5/org.jzy3d/jzy3d-core/2.0.1-SNAPSHOT/jzy3d-core-2.0.1-SNAPSHOT.jar')

It seems that an OSGi environment requires this to be exported.

Reproducibility
Add this to your .target platform:

<location includeDependencyDepth="none" includeDependencyScopes="compile" includeSource="true" missingManifest="generate" type="Maven">
		<dependencies>
			<dependency>
				<groupId>org.jzy3d</groupId>
				<artifactId>jzy3d-native-jogl-swt</artifactId>
				<version>2.0.1-SNAPSHOT</version>
				<type>jar</type>
			</dependency>
		</dependencies>
		<repositories>
			<repository>
				<id>jzy3d-snapshots</id>
				<url>https://maven.jzy3d.org/snapshots/</url>
			</repository>
		</repositories>
	</location>
	<location includeDependencyDepth="none" includeDependencyScopes="compile" includeSource="true" missingManifest="generate" type="Maven">
		<dependencies>
			<dependency>
				<groupId>org.jzy3d</groupId>
				<artifactId>jzy3d-core</artifactId>
				<version>2.0.1-SNAPSHOT</version>
				<type>jar</type>
			</dependency>
		</dependencies>
		<repositories>
			<repository>
				<id>jzy3d-snapshots</id>
				<url>https://maven.jzy3d.org/snapshots/</url>
			</repository>
		</repositories>
	</location>
	<location includeDependencyDepth="none" includeDependencyScopes="compile" includeSource="true" missingManifest="generate" type="Maven">
		<dependencies>
			<dependency>
				<groupId>org.jzy3d</groupId>
				<artifactId>jzy3d-core-swt</artifactId>
				<version>2.0.1-SNAPSHOT</version>
				<type>jar</type>
			</dependency>
		</dependencies>
		<repositories>
			<repository>
				<id>jzy3d-snapshots</id>
				<url>https://maven.jzy3d.org/snapshots/</url>
			</repository>
		</repositories>
	</location>
	<location includeDependencyDepth="none" includeDependencyScopes="compile" includeSource="true" missingManifest="generate" type="Maven">
		<dependencies>
			<dependency>
				<groupId>org.jzy3d</groupId>
				<artifactId>jzy3d-api</artifactId>
				<version>1.0.3-SNAPSHOT</version>
				<type>jar</type>
			</dependency>
		</dependencies>
		<repositories>
			<repository>
				<id>jzy3d-snapshots</id>
				<url>https://maven.jzy3d.org/snapshots/</url>
			</repository>
		</repositories>
	</location>
	<location includeDependencyDepth="none" includeSource="true" missingManifest="generate" type="Maven">
		<dependencies>
			<dependency>
				<groupId>org.jogamp.jogl</groupId>
				<artifactId>jogl-all</artifactId>
				<version>2.3.2</version>
				<type>jar</type>
			</dependency>
		</dependencies>
	</location>

This won't compile:

public class Plot3D extends Composite {

	public Plot3D(Composite parent, int style) {

		super(parent, style);
	
		SWTChartFactory chartFactorySWT = new SWTChartFactory(parent);
		Quality quality = Quality.Advanced();
		quality.setHiDPIEnabled(false);
		Chart chart = chartFactorySWT.newChart(quality);
	}
}

Versions (please complete the following information):

  • Jzy3D: 2.0.1
  • JVM / JDK: Temurin 11
  • GPU: NVIDIA Geforce GT 640
  • OS: KDE Neon

Additional context
#89

@jzy3d
Copy link
Owner

jzy3d commented May 2, 2022

There is something weird in your configuration with a reference to maven module jzy3d-api:1.0.3-SNAPSHOT. This module has disappeared as of 2.0. Also, if you are willing to work with the current SNAPSHOT version, you should not see JOGL 2.3.2 in your configuration but rather JOGL 2.4-rc4.

You should probably re-generate your Eclipse project files (or check if your Maven pom as consistent references to Jzy3D)

@Mailaender
Copy link
Author

Removing the -api package and downgrading to the release snapshot:

	<location includeDependencyDepth="none" includeDependencyScopes="compile" includeSource="true" missingManifest="generate" type="Maven">
		<dependencies>
			<dependency>
				<groupId>org.jzy3d</groupId>
				<artifactId>jzy3d-native-jogl-swt</artifactId>
				<version>2.0.0</version>
				<type>jar</type>
			</dependency>
		</dependencies>
		<repositories>
			<repository>
				<id>jzy3d-releases</id>
				<url>https://maven.jzy3d.org/releases/</url>
			</repository>
		</repositories>
	</location>
	<location includeDependencyDepth="none" includeDependencyScopes="compile" includeSource="true" missingManifest="generate" type="Maven">
		<dependencies>
			<dependency>
				<groupId>org.jzy3d</groupId>
				<artifactId>jzy3d-core</artifactId>
				<version>2.0.0</version>
				<type>jar</type>
			</dependency>
		</dependencies>
		<repositories>
			<repository>
				<id>jzy3d-releases</id>
				<url>https://maven.jzy3d.org/releases/</url>
			</repository>
		</repositories>
	</location>
	<location includeDependencyDepth="none" includeDependencyScopes="compile" includeSource="true" missingManifest="generate" type="Maven">
		<dependencies>
			<dependency>
				<groupId>org.jzy3d</groupId>
				<artifactId>jzy3d-core-swt</artifactId>
				<version>2.0.0</version>
				<type>jar</type>
			</dependency>
		</dependencies>
		<repositories>
			<repository>
				<id>jzy3d-releases</id>
				<url>https://maven.jzy3d.org/releases/</url>
			</repository>
		</repositories>
	</location>
	<location includeDependencyDepth="none" includeSource="true" missingManifest="generate" type="Maven">
		<dependencies>
			<dependency>
				<groupId>org.jogamp.jogl</groupId>
				<artifactId>jogl-all</artifactId>
				<version>2.3.2</version>
				<type>jar</type>
			</dependency>
		</dependencies>
	</location>

reveals the same error:

Access restriction: The method 'ChartFactory.newChart(Quality)' is not API (restriction on required library '~/Eclipse/rcp-2022-03/eclipse/configuration/org.eclipse.osgi/291/data/f2c50ff5598514905948ed0f33983d582e6a69e5/org.jzy3d/jzy3d-core/2.0.0/jzy3d-core-2.0.0.jar')

I don't understand why it is this particular function and nothing else.

@jzy3d
Copy link
Owner

jzy3d commented May 2, 2022

The method really is part of the API in 2.0.0 (and 2.0.1).

This fix looks weird but is worth trying. Maybe Eclipse did no rebuilt things since you remove references to 1.0.3?

@Mailaender
Copy link
Author

I was hoping for something like jamesmudd/jhdf#367 but I don't see where you export packages and create this metadata.

@jzy3d
Copy link
Owner

jzy3d commented May 2, 2022

I haven't done this. Reading the discussion you mentioned shows that the proposal finally was implemented somewhere else.

The Maven Jar Plugin is already in the main pom file. Maybe we can use it to add the key/values required by OSGi in the manifest file?

@Mailaender
Copy link
Author

I tried to follow the instructions at https://felix.apache.org/documentation/subprojects/apache-felix-maven-bundle-plugin-bnd.html but that so far only lead to unit tests fail.

@jzy3d jzy3d added the bug label May 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants