Skip to content

Commit

Permalink
Merge pull request #6 from openjdk/master
Browse files Browse the repository at this point in the history
Merge
  • Loading branch information
tsayao committed Feb 27, 2020
2 parents 37519d7 + ef2f9ce commit 5dccb63
Show file tree
Hide file tree
Showing 34 changed files with 9,272 additions and 5,574 deletions.
6 changes: 3 additions & 3 deletions apps/samples/.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
<classpathentry kind="src" path="Ensemble8/src/compiletime/java"/>
<classpathentry kind="src" path="Ensemble8/src/generated/java"/>
<classpathentry kind="src" path="Ensemble8/src/generated/resources"/>
<classpathentry kind="lib" path="Ensemble8/lib/lucene-core-7.7.1.jar"/>
<classpathentry kind="lib" path="Ensemble8/lib/lucene-grouping-7.7.1.jar"/>
<classpathentry kind="lib" path="Ensemble8/lib/lucene-queryparser-7.7.1.jar"/>
<classpathentry kind="lib" path="Ensemble8/lib/lucene-core-7.7.2.jar"/>
<classpathentry kind="lib" path="Ensemble8/lib/lucene-grouping-7.7.2.jar"/>
<classpathentry kind="lib" path="Ensemble8/lib/lucene-queryparser-7.7.2.jar"/>
<classpathentry kind="src" path="MandelbrotSet/src"/>
<classpathentry kind="src" path="Modena/src/main/java"/>
<classpathentry kind="src" path="Modena/src/main/resources"/>
Expand Down
4 changes: 2 additions & 2 deletions apps/samples/Ensemble8/UPDATING-lucene.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ To update to a new version of Lucene:
gradle clean
gradle sdk apps

NOTE: if upgrading to a new major version there are usually compilation errors that need to be fixed.
NOTE: if upgrading to a new major version there are usually compilation or runtime errors that need to be fixed.


3. Regenerate the index files:
3. Regenerate the index files. This step can be skipped if only the "bugfix" number (the third digit) of the release changes:

$ cd apps/samples/Ensemble8
$ rm -rf src/generated/resources/ensemble/search/index
Expand Down
6 changes: 3 additions & 3 deletions apps/samples/Ensemble8/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ apply plugin:'application'
def mainClassName = "ensemble.EnsembleApp"

def FileCollection apachecp = files(
"./lib/lucene-core-7.7.1.jar",
"./lib/lucene-grouping-7.7.1.jar",
"./lib/lucene-queryparser-7.7.1.jar")
"./lib/lucene-core-7.7.2.jar",
"./lib/lucene-grouping-7.7.2.jar",
"./lib/lucene-queryparser-7.7.2.jar")

sourceSets {
main {
Expand Down
2 changes: 1 addition & 1 deletion apps/samples/Ensemble8/legal/lucene.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Apache Lucene v7.7.1
## Apache Lucene v7.7.2

### Apache Lucene Notice
```
Expand Down
2 changes: 1 addition & 1 deletion apps/samples/Ensemble8/nbproject/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ dist.jar=${dist.dir}/Ensemble8.jar
dist.javadoc.dir=${dist.dir}/javadoc
endorsed.classpath=
excludes=
lucene.version=7.7.1
lucene.version=7.7.2
file.reference.lucene-core.jar=lib/lucene-core-${lucene.version}.jar
file.reference.lucene-grouping.jar=lib/lucene-grouping-${lucene.version}.jar
file.reference.lucene-queryparser.jar=lib/lucene-queryparser-${lucene.version}.jar
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4148,7 +4148,7 @@ project(":apps") {
// The apps build is Ant based, we will exec ant from gradle.

// Download the Lucene libraries needed for the Ensemble8 app
def luceneVersion = "7.7.1"
def luceneVersion = "7.7.2"
getConfigurations().create("lucene");
dependencies {
lucene group: "org.apache.lucene", name: "lucene-core", version: luceneVersion
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -71,6 +71,7 @@ public class PlatformUtil {
private static final boolean LINUX = os.startsWith("Linux") && !ANDROID;
private static final boolean SOLARIS = os.startsWith("SunOS");
private static final boolean IOS = os.startsWith("iOS");
private static final boolean STATIC_BUILD = "Substrate VM".equals(System.getProperty("java.vm.name"));

/**
* Utility method used to determine whether the version number as
Expand Down Expand Up @@ -177,6 +178,13 @@ public static boolean isIOS(){
return IOS;
}

/**
* Returns true if the current runtime is a statically linked image
*/
public static boolean isStaticBuild(){
return STATIC_BUILD;
}

private static void loadPropertiesFromFile(final File file) {
Properties p = new Properties();
try {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -576,7 +576,7 @@ public static <T> boolean replaceAll(ObservableList<T> list, T oldVal, T newVal)
}

/**
* Reverse the order in the list
* Reverses the order in the list.
* Fires only <b>one</b> change notification on the list.
* @param list the list to be reversed
* @see Collections#reverse(java.util.List)
Expand Down
3 changes: 2 additions & 1 deletion modules/javafx.base/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -49,6 +49,7 @@
javafx.controls,
javafx.graphics,
javafx.fxml,
javafx.media,
javafx.swing;
exports com.sun.javafx.beans to
javafx.controls,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand All @@ -25,6 +25,8 @@

package com.sun.pisces;

import com.sun.prism.impl.Disposer;

public abstract class AbstractSurface implements Surface {

private long nativePtr = 0L;
Expand All @@ -46,6 +48,10 @@ public abstract class AbstractSurface implements Surface {
this.height = height;
}

protected void addDisposerRecord() {
Disposer.addRecord(this, new AbstractSurfaceDisposerRecord(nativePtr));
}

public final void getRGB(int[] argb, int offset, int scanLength, int x, int y, int width, int height) {
this.rgbCheck(argb.length, offset, scanLength, x, y, width, height);
this.getRGBImpl(argb, offset, scanLength, x, y, width, height);
Expand Down Expand Up @@ -97,8 +103,22 @@ private void rgbCheck(int arr_length, int offset, int scanLength, int x, int y,
}
}

protected void finalize() {
this.nativeFinalize();
private static native void disposeNative(long nativeHandle);

private static class AbstractSurfaceDisposerRecord implements Disposer.Record {
private long nativeHandle;

AbstractSurfaceDisposerRecord(long nh) {
nativeHandle = nh;
}

@Override
public void dispose() {
if (nativeHandle != 0L) {
disposeNative(nativeHandle);
nativeHandle = 0L;
}
}
}

public final int getWidth() {
Expand All @@ -108,6 +128,4 @@ public final int getWidth() {
public final int getHeight() {
return height;
}

private native void nativeFinalize();
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -43,6 +43,12 @@ public JavaSurface(int[] dataInt, int dataType, int width, int height) {
this.dataBuffer = IntBuffer.wrap(this.dataInt);

initialize(dataType, width, height);
// The native method initialize() creates the native object of
// struct JavaSurface and saves it's reference in the super class
// member AbstractSurface.nativePtr. This reference is needed for
// creating disposer record hence the below call to addDisposerRecord()
// is needed here and cannot be made in super class constructor.
addDisposerRecord();
}

public IntBuffer getDataIntBuffer() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand All @@ -25,6 +25,8 @@

package com.sun.pisces;

import com.sun.prism.impl.Disposer;

/**
* PiscesRenderer class is basic public API accessing Pisces library capabilities.
*
Expand Down Expand Up @@ -86,6 +88,7 @@ public final class PiscesRenderer {
public PiscesRenderer(AbstractSurface surface) {
this.surface = surface;
initialize();
Disposer.addRecord(this, new PiscesRendererDisposerRecord(nativePtr));
}

private native void initialize();
Expand Down Expand Up @@ -436,12 +439,21 @@ private void inputImageCheck(int width, int height, int offset, int stride, int
}
}

protected void finalize() {
this.nativeFinalize();
}
private static native void disposeNative(long nativeHandle);

/**
* Native finalizer. Releases native memory used by PiscesRenderer at lifetime.
*/
private native void nativeFinalize();
private static class PiscesRendererDisposerRecord implements Disposer.Record {
private long nativeHandle;

PiscesRendererDisposerRecord(long nh) {
nativeHandle = nh;
}

@Override
public void dispose() {
if (nativeHandle != 0L) {
disposeNative(nativeHandle);
nativeHandle = 0L;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ public final ReadOnlyObjectProperty<Duration> cycleDurationProperty() {

/**
* Read-only variable to indicate the total duration of this
* {@code Animation}, including repeats. A {@code Animation} with a {@code cycleCount}
* {@code Animation}, including repeats. An {@code Animation} with a {@code cycleCount}
* of {@code Animation.INDEFINITE} will have a {@code totalDuration} of
* {@code Duration.INDEFINITE}.
*
Expand Down Expand Up @@ -961,7 +961,7 @@ public void playFromStart() {

/**
* Stops the animation and resets the play head to its initial position. If
* the animation is not currently running, this method has no effect.
* the animation is already stopped, this method has no effect.
* <p>
* Note: <ul>
* <li>{@code stop()} is an asynchronous call, the {@code Animation} may not stop
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -175,7 +175,7 @@ public static void requestNextPulse() {

/**
* Returns true if the calling thread is the JavaFX Application Thread.
* Use this call the ensure that a given task is being executed
* Use this call to ensure that a given task is being executed
* (or not being executed) on the JavaFX Application Thread.
*
* @return true if running on the JavaFX Application Thread
Expand Down
4 changes: 2 additions & 2 deletions modules/javafx.graphics/src/main/java/javafx/scene/Node.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -1566,7 +1566,7 @@ public final Node getClip() {
}

/**
* Specifies a {@code Node} to use to define the the clipping shape for this
* Specifies a {@code Node} to use to define the clipping shape for this
* Node. This clipping Node is not a child of this {@code Node} in the scene
* graph sense. Rather, it is used to define the clip for this {@code Node}.
* <p>
Expand Down
4 changes: 2 additions & 2 deletions modules/javafx.graphics/src/main/native-glass/win/OleUtils.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -227,7 +227,7 @@ inline HRESULT checkJavaException(JNIEnv *env)
s_jcidThrowable_getMessage
));
if(jsMessage){
STRACE1(_T("Java Messsge:%s"), (LPCWSTR)JString(env, jsMessage) );
STRACE1(_T("Java Message:%s"), (LPCWSTR)JString(env, jsMessage) );
}
env->ExceptionDescribe();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -37,7 +37,6 @@ static jfieldID fieldIds[SURFACE_LAST + 1];
static jboolean fieldIdsInitialized = JNI_FALSE;

static jboolean initializeSurfaceFieldIds(JNIEnv* env, jobject objectHandle);
static void disposeNativeImpl(JNIEnv* env, jobject objectHandle);

AbstractSurface*
surface_get(JNIEnv* env, jobject surfaceHandle) {
Expand All @@ -52,9 +51,14 @@ surface_initialize(JNIEnv* env, jobject surfaceHandle) {
}

JNIEXPORT void JNICALL
Java_com_sun_pisces_AbstractSurface_nativeFinalize(JNIEnv* env,
jobject objectHandle) {
disposeNativeImpl(env, objectHandle);
Java_com_sun_pisces_AbstractSurface_disposeNative(JNIEnv *env, jclass cls, jlong nativePtr)
{
AbstractSurface* surface = (AbstractSurface*) JLongToPointer(nativePtr);

if (surface != NULL) {
surface->cleanup(surface);
surface_dispose(&surface->super);
}
}

JNIEXPORT void JNICALL
Expand Down Expand Up @@ -184,29 +188,3 @@ initializeSurfaceFieldIds(JNIEnv* env, jobject objectHandle) {

return retVal;
}

static void
disposeNativeImpl(JNIEnv* env, jobject objectHandle) {
AbstractSurface* surface;

if (!fieldIdsInitialized) {
return;
}

surface = (AbstractSurface*)JLongToPointer(
(*env)->GetLongField(env, objectHandle,
fieldIds[SURFACE_NATIVE_PTR]));

if (surface != NULL) {
surface->cleanup(surface);
surface_dispose(&surface->super);
(*env)->SetLongField(env, objectHandle, fieldIds[SURFACE_NATIVE_PTR],
(jlong)0);

if (JNI_TRUE == readAndClearMemErrorFlag()) {
JNI_ThrowNew(env, "java/lang/OutOfMemoryError",
"Allocation of internal renderer buffer failed.");
}
}
}

Loading

0 comments on commit 5dccb63

Please sign in to comment.