Skip to content

Commit

Permalink
Fix the failing tests belonging to Simple(DateFormatTest) classes as …
Browse files Browse the repository at this point in the history
  • Loading branch information
varad64 committed Jun 30, 2023
2 parents 1f99a23 + 48ea48f commit bd53d73
Show file tree
Hide file tree
Showing 201 changed files with 6,455 additions and 1,220 deletions.
10 changes: 4 additions & 6 deletions .github/workflows/simple_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: baseline build

on:
push:
branches: [ master, develop ]
branches: [ java-10-gradle ]
pull_request:
branches: [ master, develop ]
branches: [ java-10-gradle ]
workflow_dispatch:

jobs:
Expand All @@ -18,12 +18,10 @@ jobs:
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up JDK 1.8
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: 8
java-version: 11
distribution: 'adopt'
- name: Build with Gradle
run: ./gradlew check
- name: Run PolDet test
run: ./gradlew testPolDet
11 changes: 10 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ nbdist/
.nb-gradle/

####### Covers Eclipse IDE #######
.idea/
.metadata
tmp/
*.tmp
Expand All @@ -48,6 +47,10 @@ tmp/
.idea/**/tasks.xml
.idea/dictionaries
.idea/ant.xml
.idea/misc.xml
.idea/vcs.xml
.idea/compiler.xml
.idea/modules.xml

# Sensitive or high-churn files:
.idea/**/dataSources/
Expand All @@ -71,3 +74,9 @@ out/

# JIRA plugin
atlassian-ide-plugin.xml
/.idea/
/test.bat

#local files
local
temp.ser
17 changes: 17 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
language: java

jdk:
- oraclejdk11

script:
- ./gradlew check

before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/

cache:
directories:
- $HOME/.gradle/caches/
- $HOME/.gradle/wrapper/

30 changes: 29 additions & 1 deletion gradle/source-sets.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,15 @@ sourceSets {
compileClasspath += sourceSets.main.output
}
classes {
java.srcDirs = ["src/classes"]
java.srcDirs = ["src/classes/gov", "src/classes/org"]
java.outputDir = file("${buildDir}/classes")
compileClasspath += sourceSets.main.output + sourceSets.annotations.output
}
modules {
java.srcDirs = ["src/classes/modules"]
java.outputDir = file("${buildDir}/classes")
compileClasspath += sourceSets.classes.output + sourceSets.main.output + sourceSets.annotations.output
}
peers {
java.srcDirs = ["src/peers"]
java.outputDir = file("${buildDir}/peers")
Expand All @@ -30,3 +35,26 @@ sourceSets {
runtimeClasspath += compileClasspath
}
}

compilePeersJava.options.compilerArgs += [
'--add-exports', 'java.base/jdk.internal.misc=ALL-UNNAMED'
]

compileClassesJava.options.compilerArgs += [
'--patch-module', 'java.base=' + files(sourceSets.modules.java.srcDirs).asPath + '/java.base',
'--patch-module', 'java.logging=' + files(sourceSets.modules.java.srcDirs).asPath + '/java.logging',
'--add-exports', 'java.base/sun.net.www.protocol.http=ALL-UNNAMED',
'--add-reads', 'java.base=ALL-UNNAMED'
]

compileModulesJava.options.compilerArgs += [
'--patch-module', 'java.base=' + files(sourceSets.modules.java.srcDirs).asPath + '/java.base',
'--patch-module', 'java.logging=' + files(sourceSets.modules.java.srcDirs).asPath + '/java.logging',
'--add-exports', 'java.base/sun.net.www.protocol.http=ALL-UNNAMED',
'--add-reads', 'java.base=ALL-UNNAMED',
'--module-source-path', files(sourceSets.modules.java.srcDirs).asPath
]

compileTestJava.options.compilerArgs += [
'--add-exports', 'java.base/jdk.internal.misc=ALL-UNNAMED'
]
3 changes: 2 additions & 1 deletion jpf.properties
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ jpf-core.native_classpath=\

jpf-core.classpath=\
${jpf-core}/build/jpf-classes.jar;\
${jpf-core}/build/examples
${jpf-core}/build/examples;\
${jpf-core}/build/classes

jpf-core.sourcepath=\
${jpf-core}/src/examples
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import java.util.HashMap;
import java.util.Map;

import sun.reflect.ConstantPool;
import jdk.internal.reflect.ConstantPool;
import sun.reflect.annotation.AnnotationType;

/**
Expand Down Expand Up @@ -60,6 +60,9 @@ public final class Class<T> implements Serializable, GenericDeclaration, Type, A

private String name;

// set by VM
private transient Module module;

private ClassLoader classLoader;

/**
Expand Down Expand Up @@ -120,8 +123,23 @@ public InputStream getResourceAsStream (String name) {

private native String getResolvedName (String rname);

public native String getModuleName();

public native String getModuleNameFromClassFileURL();

public native boolean isJPFClass();

public URL getResource (String rname) {
String resolvedName = getResolvedName(rname);
String moduleName = getModuleName();

if (moduleName != null) {
if(isJPFClass())
resolvedName = "modules/" + moduleName + "/" + resolvedName;
else
resolvedName = moduleName + "/" + resolvedName;
}

return getClassLoader().getResource(resolvedName);
}

Expand Down Expand Up @@ -242,6 +260,7 @@ public boolean isPrimitive () {

public native Class<? super T> getSuperclass ();

@Deprecated(since = "9")
public native T newInstance () throws InstantiationException,
IllegalAccessException;

Expand Down Expand Up @@ -359,4 +378,8 @@ public boolean isSynthetic (){
final int SYNTHETIC = 0x00001000;
return (getModifiers() & SYNTHETIC) != 0;
}

public Module getModule() {
return module;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@
import java.net.URL;
import java.nio.ByteBuffer;
import java.security.ProtectionDomain;
import java.util.Collection;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.Vector;

import sun.misc.CompoundEnumeration;

/**
* @author Nastaran Shafiei <[email protected]>
*
Expand Down Expand Up @@ -102,16 +102,28 @@ private Enumeration<URL> getResourcesURL(String name) {

@SuppressWarnings({"unchecked","rawtypes"})
public Enumeration<URL> getResources(String name) throws IOException {
Enumeration<URL>[] resEnum = new Enumeration[2];
Vector<URL> collection = new Vector<>();

if(parent == null) {
resEnum[0] = getSystemClassLoader().getResourcesURL(name);
} else{
resEnum[0] = parent.getResources(name);
if (parent == null) {
Enumeration<URL> urls = getSystemClassLoader().getResourcesURL(name);

while (urls.hasMoreElements()) {
collection.add(urls.nextElement());
}
resEnum[1] = findResources(name);
} else {
Enumeration<URL> resources = parent.getResources(name);

return new CompoundEnumeration<URL>(resEnum);
while (resources.hasMoreElements()) {
collection.add(resources.nextElement());
}
}
Enumeration<URL> resources = findResources(name);

while (resources.hasMoreElements()) {
collection.add(resources.nextElement());
}

return collection.elements();
}

/**
Expand All @@ -135,9 +147,11 @@ public InputStream getResourceAsStream (String name){
return null;
}

public native static ClassLoader getSystemClassLoader ();
public native static ClassLoader getSystemClassLoader();

public static URL getSystemResource(String name){
public native static ClassLoader getPlatformClassLoader();

public static URL getSystemResource(String name) {
return getSystemClassLoader().getResource(name);
}

Expand Down Expand Up @@ -254,4 +268,29 @@ protected Package definePackage(String name, String specTitle, String specVersio
throws IllegalArgumentException {
throw new UnsupportedOperationException();
}

/**
* Written as a replacement for the auxiliary class {@link CompoundEnumeration}
*/
final class EnumerationAdapter<E> implements Enumeration<E> {
private final Iterator<E> iterator;

public EnumerationAdapter(Collection<E> collection) {
iterator = collection.iterator();
}

@Override
public boolean hasMoreElements() {
return iterator.hasNext();
}

@Override
public E nextElement() {
return iterator.next();
}
}

public native final Package getDefinedPackage(final String name);

public native final Package[] getDefinedPackages();
}
File renamed without changes.
Loading

0 comments on commit bd53d73

Please sign in to comment.