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

Enforce encapsulation of equinox-launcher Constants and JNIBridge #565

Merged
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion bundles/org.eclipse.equinox.launcher/META-INF/MANIFEST.MF
Expand Up @@ -8,6 +8,5 @@ Bundle-Vendor: %providerName
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-Localization: launcher
Export-Package: org.eclipse.core.launcher;x-internal:=true,
org.eclipse.equinox.internal.launcher;x-internal:=true,
org.eclipse.equinox.launcher;x-internal:=true
Automatic-Module-Name: org.eclipse.equinox.launcher
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2006, 2009 IBM Corporation and others.
* Copyright (c) 2006, 2024 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand All @@ -11,12 +11,12 @@
* Contributors:
* Andrew Niefer - IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.equinox.internal.launcher;
package org.eclipse.equinox.launcher;

/**
* @author aniefer
*/
public class Constants {
class Constants {
public static final String INTERNAL_AMD64 = "amd64"; //$NON-NLS-1$
public static final String INTERNAL_OS_SUNOS = "SunOS"; //$NON-NLS-1$
public static final String INTERNAL_OS_LINUX = "Linux"; //$NON-NLS-1$
Expand Down
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2006, 2015 IBM Corporation and others.
* Copyright (c) 2006, 2024 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand All @@ -23,8 +23,7 @@
* @noextend This class is not intended to be subclassed by clients.
* @noinstantiate This class is not intended to be instantiated by clients.
*/
public class JNIBridge {
//TODO: This class should not be public
class JNIBridge {
private native void _set_exit_data(String sharedId, String data);

private native void _set_launcher_info(String launcher, String name);
Expand Down
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2018 IBM Corporation and others.
* Copyright (c) 2000, 2024 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -59,8 +59,6 @@
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;

import org.eclipse.equinox.internal.launcher.Constants;

/**
* The launcher for Eclipse.
*
Expand Down
Expand Up @@ -37,7 +37,7 @@
<configuration>
<archive>
<manifest>
<mainClass>main.TestLauncherApp</mainClass>
<mainClass>org.eclipse.equinox.launcher.TestLauncherApp</mainClass>
</manifest>
</archive>
</configuration>
Expand Down
Expand Up @@ -11,7 +11,7 @@
* Contributors:
* Umair Sair - initial API and implementation
*******************************************************************************/
package main;
package org.eclipse.equinox.launcher;
HannesWell marked this conversation as resolved.
Show resolved Hide resolved

import java.io.BufferedReader;
import java.io.DataOutputStream;
Expand All @@ -21,8 +21,6 @@
import java.util.ArrayList;
import java.util.List;

import org.eclipse.equinox.launcher.JNIBridge;

/**
* Dummy test application used for eclipse launcher testing. JUnit tests
* launches the eclipse launcher with startup application pointing to the jar file
Expand All @@ -31,11 +29,11 @@
* port and accepts following queries
* - -args - returns the arguments passed to this application. Test verify if the
* arguments are passed to application correctly by the launcher.
*
*
* And accepts following information
* - -exitdata - The exit data this application should set before exiting
* - -exitcode - The exit code with which this application should exit
*
*
* @author umairsair
*
*/
Expand Down Expand Up @@ -98,8 +96,9 @@ private static void communicateToServer() throws Exception {
out.flush();
} else if (TestLauncherConstants.EXITDATA_PARAMETER.equals(line)) {
while ((line = in.readLine()) != null) {
if (TestLauncherConstants.MULTILINE_ARG_VALUE_TERMINATOR.equals(line))
if (TestLauncherConstants.MULTILINE_ARG_VALUE_TERMINATOR.equals(line)) {
break;
}
exitData.add(line);
}
} else if (TestLauncherConstants.EXITCODE_PARAMETER.equals(line)) {
Expand Down
Expand Up @@ -11,7 +11,7 @@
* Contributors:
* Umair Sair - initial API and implementation
*******************************************************************************/
package main;
package org.eclipse.equinox.launcher;

public interface TestLauncherConstants {
public static final String ARGS_PARAMETER = "-args"; //$NON-NLS-1$
Expand Down
Expand Up @@ -32,12 +32,11 @@
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;

import org.eclipse.equinox.launcher.TestLauncherConstants;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import main.TestLauncherConstants;

public class LauncherTests {
private static final String ECLIPSE_INI_PATH_KEY = "ECLIPSE_INI_PATH";
// eclipse ini file name is relative to eclipse binary. e.g., in mac, it is ../Eclipse/eclipse.ini
Expand Down