Skip to content

Commit

Permalink
Updates based on feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleAure committed Oct 26, 2023
1 parent e68b1d7 commit 8d14a79
Show file tree
Hide file tree
Showing 13 changed files with 126 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ private static boolean isTransformPossible(byte[] bytes) {
if (isJDK8WithHotReplaceBug)
return classFileVersion <= Opcodes.V1_7;
else
return classFileVersion <= Opcodes.V17;
return classFileVersion <= Opcodes.V22;
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
/*******************************************************************************
* Copyright (c) 2023 IBM Corporation and others.
* All rights reserved. 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
* http://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package com.ibm.example.bytecode;

public class HelloWorldJava11 {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
/*******************************************************************************
* Copyright (c) 2023 IBM Corporation and others.
* All rights reserved. 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
* http://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package com.ibm.example.bytecode;

public class HelloWorldJava17 {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
/*******************************************************************************
* Copyright (c) 2023 IBM Corporation and others.
* All rights reserved. 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
* http://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package com.ibm.example.bytecode;

public class HelloWorldJava21 {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
/*******************************************************************************
* Copyright (c) 2023 IBM Corporation and others.
* All rights reserved. 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
* http://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package com.ibm.example.bytecode;

public class HelloWorldJava6 {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
/*******************************************************************************
* Copyright (c) 2023 IBM Corporation and others.
* All rights reserved. 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
* http://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package com.ibm.example.bytecode;

public class HelloWorldJava7 {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
/*******************************************************************************
* Copyright (c) 2023 IBM Corporation and others.
* All rights reserved. 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
* http://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package com.ibm.example.bytecode;

public class HelloWorldJava7StaticInit {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
/*******************************************************************************
* Copyright (c) 2023 IBM Corporation and others.
* All rights reserved. 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
* http://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package com.ibm.example.bytecode;

public class HelloWorldJava8 {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
/*******************************************************************************
* Copyright (c) 2023 IBM Corporation and others.
* All rights reserved. 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
* http://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package com.ibm.example.bytecode;

import java.util.concurrent.Callable;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
/*******************************************************************************
* Copyright (c) 2023 IBM Corporation and others.
* All rights reserved. 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
* http://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package com.ibm.example.bytecode;

public class HelloWorldJava8StaticInit {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
/*******************************************************************************
* Copyright (c) 2023 IBM Corporation and others.
* All rights reserved. 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
* http://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package com.ibm.example.bytecode;

import java.util.concurrent.Callable;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
## Source files

The classes compiled in this package are not meant to be used for testing.
Instead, they are placeholder .java files that we need to manually compile at different java levels.
The compiled classes will then be put into the `test data` directory.
The classes in this directory are the source files for the .class files located in the `test data` directory.
If you are adding a new class to this directory you need to manually compile it at the java level it was written to be tested against.

### Generate new class files

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@

import com.ibm.ws.ras.instrument.internal.main.LibertyRuntimeTransformer;

//TODO add tests that make sure classes are instrumented with trace.
@SuppressWarnings("deprecation")
public class RasTransformTest extends LibertyRuntimeTransformer {

Expand Down Expand Up @@ -71,7 +72,7 @@ public static void setup() {
majorCodeMap.put("19", 63);
majorCodeMap.put("20", 64);
majorCodeMap.put("21", 65);
majorCodeMap.put("22", 65);
majorCodeMap.put("22", 66);
}

/**
Expand Down Expand Up @@ -388,9 +389,8 @@ public void testJava17Basic() {

}

//FIXME - This test is currently failing because isTransformPossible returns false
//TODO expand this test to actually test Java 21 features https://openjdk.org/jeps/441
//@Test
@Test
public void testJava21Basic() {
assumeTrue(Integer.parseInt(System.getProperty("java.specification.version")) >= 21);
String classPath = "test/test data/com/ibm/example/bytecode/HelloWorldJava21.class";
Expand Down

0 comments on commit 8d14a79

Please sign in to comment.