Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
998 changes: 420 additions & 578 deletions sources/net.sf.j2s.core/dist/README.txt

Large diffs are not rendered by default.

Binary file modified sources/net.sf.j2s.core/dist/swingjs/SwingJS-site.zip
Binary file not shown.
Binary file modified sources/net.sf.j2s.core/dist/swingjs/net.sf.j2s.core.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion sources/net.sf.j2s.core/dist/swingjs/timestamp
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20191120224140
20191122095542
Binary file modified sources/net.sf.j2s.core/dist/swingjs/ver/3.2.5/SwingJS-site.zip
Binary file not shown.
Binary file modified sources/net.sf.j2s.core/dist/swingjs/ver/3.2.5/net.sf.j2s.core.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion sources/net.sf.j2s.core/dist/swingjs/ver/3.2.5/timestamp
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20191120224140
20191122095542
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class CorePlugin extends Plugin {
* "net.sf.j2s.core.jar" not "net.sf.j2s.core.3.2.5"
*
*/
public static String VERSION = "3.2.5-v0";
public static String VERSION = "3.2.5-v1";
// BH 2019.11.12 -- 3.2.5-v0 fix for string literals with \n \nn \nnn octals, but "use strict" does not allow for this.
// BH 2019.11.13 -- 3.2.5-v0 fixes static initialization timing. See note in Java2ScriptVisitor
// BH 2019.10.30 -- 3.2.4.09 fixes problem with team...show history...compare having null project.getProject().getLocation()
Expand Down
210 changes: 152 additions & 58 deletions sources/net.sf.j2s.core/src/net/sf/j2s/core/Java2ScriptVisitor.java

Large diffs are not rendered by default.

Binary file modified sources/net.sf.j2s.java.core/dist/SwingJS-site.zip
Binary file not shown.
176 changes: 85 additions & 91 deletions sources/net.sf.j2s.java.core/src/java/lang/Class.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

import java.io.IOException;
import java.io.InputStream;
import java.lang.annotation.Annotation;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.GenericSignatureFormatError;
Expand All @@ -41,25 +42,14 @@
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

import javax.xml.bind.annotation.XmlRootElement;

import sun.misc.CompoundEnumeration;
import sun.reflect.annotation.AnnotationType;
import swingjs.JSUtil;

//import sun.misc.Unsafe;
//import sun.reflect.ConstantPool;
//import sun.reflect.Reflection;
//import sun.reflect.ReflectionFactory;
//import sun.reflect.annotation.AnnotationType;
//import sun.reflect.generics.factory.CoreReflectionFactory;
//import sun.reflect.generics.factory.GenericsFactory;
//import sun.reflect.generics.repository.ClassRepository;
//import sun.reflect.generics.repository.ConstructorRepository;
//import sun.reflect.generics.repository.MethodRepository;
//import sun.reflect.generics.scope.ClassScope;
//import sun.security.util.SecurityConstants;

/**
* Instances of the class {@code Class} represent classes and interfaces in a
* running Java application. An enum is a kind of class and an annotation is a
Expand Down Expand Up @@ -3431,7 +3421,6 @@ Map<String, T> enumConstantDirectory() {
*
* @since 1.5
*/
@SuppressWarnings("unchecked")
public T cast(Object obj) {
if (obj != null && !isInstance(obj))
throw new ClassCastException(cannotCastMsg(obj));
Expand All @@ -3442,76 +3431,87 @@ private String cannotCastMsg(Object obj) {
return "Cannot cast " + obj.getClass().getName() + " to " + getName();
}

// /**
// * Casts this {@code Class} object to represent a subclass of the class
// * represented by the specified class object. Checks that that the cast is
// * valid, and throws a {@code ClassCastException} if it is not. If this
// * method succeeds, it always returns a reference to this class object.
// *
// * <p>
// * This method is useful when a client needs to "narrow" the type of a
// * {@code Class} object to pass it to an API that restricts the
// * {@code Class} objects that it is willing to accept. A cast would generate
// * a compile-time warning, as the correctness of the cast could not be
// * checked at runtime (because generic types are implemented by erasure).
// *
// * @return this {@code Class} object, cast to represent a subclass of the
// * specified class object.
// * @throws ClassCastException
// * if this {@code Class} object does not represent a subclass of
// * the specified class (here "subclass" includes the class
// * itself).
// * @since 1.5
// */
// public <U> Class<? extends U> asSubclass(Class<U> clazz) {
// if (clazz.isAssignableFrom(this))
// return (Class<? extends U>) this;
// else
// throw new ClassCastException(this.toString());
// }
/**
* Casts this {@code Class} object to represent a subclass of the class
* represented by the specified class object. Checks that that the cast is
* valid, and throws a {@code ClassCastException} if it is not. If this
* method succeeds, it always returns a reference to this class object.
*
* <p>
* This method is useful when a client needs to "narrow" the type of a
* {@code Class} object to pass it to an API that restricts the
* {@code Class} objects that it is willing to accept. A cast would generate
* a compile-time warning, as the correctness of the cast could not be
* checked at runtime (because generic types are implemented by erasure).
*
* @return this {@code Class} object, cast to represent a subclass of the
* specified class object.
* @throws ClassCastException
* if this {@code Class} object does not represent a subclass of
* the specified class (here "subclass" includes the class
* itself).
* @since 1.5
*/
public <U> Class<? extends U> asSubclass(Class<U> clazz) {
if (clazz.isAssignableFrom(this))
return (Class<? extends U>) this;
else
throw new ClassCastException(this.toString());
}

/**
* @throws NullPointerException {@inheritDoc}
* @since 1.5
*/
public <A extends Annotation> A getAnnotation(Class<A> annotationClass) {
Objects.requireNonNull(annotationClass);
JSUtil.notImplemented(null);
return null;
}

// /**
// * @throws NullPointerException
// * {@inheritDoc}
// * @since 1.5
// */
// public <A extends Annotation> A getAnnotation(Class<A> annotationClass) {
// if (annotationClass == null)
// throw new NullPointerException();
//
// initAnnotationsIfNecessary();
// return (A) annotations.get(annotationClass);
// public XmlRootElement getAnnotation(Class<XmlRootElement> c) {
//
// // TODO Auto-generated method stub
// return null;
// }
//
// /**
// * @throws NullPointerException
// * {@inheritDoc}
// * @since 1.5
// */
// public boolean isAnnotationPresent(Class<? extends Annotation> annotationClass) {
// if (annotationClass == null)
// throw new NullPointerException();
//
/**
* @throws NullPointerException
* {@inheritDoc}
* @since 1.5
*/
public boolean isAnnotationPresent(Class<? extends Annotation> annotationClass) {
if (annotationClass == null)
throw new NullPointerException();
JSUtil.notImplemented(null);
return false;
// return getAnnotation(annotationClass) != null;
// }
//
// private static Annotation[] EMPTY_ANNOTATIONS_ARRAY = new Annotation[0];
//
// /**
// * @since 1.5
// */
// public Annotation[] getAnnotations() {
}

private static Annotation[] EMPTY_ANNOTATIONS_ARRAY;

private static Annotation[] getEmptyAnnotations() {
return (EMPTY_ANNOTATIONS_ARRAY == null ? EMPTY_ANNOTATIONS_ARRAY = new Annotation[0] : EMPTY_ANNOTATIONS_ARRAY);
}
/**
* @since 1.5
*/
public Annotation[] getAnnotations() {
JSUtil.notImplemented(null);
return getEmptyAnnotations();
// initAnnotationsIfNecessary();
// return annotations.values().toArray(EMPTY_ANNOTATIONS_ARRAY);
// }
//
// /**
// * @since 1.5
// */
// public Annotation[] getDeclaredAnnotations() {
}

/**
* @since 1.5
*/
public Annotation[] getDeclaredAnnotations() {
JSUtil.notImplemented(null);
return getEmptyAnnotations();
// initAnnotationsIfNecessary();
// return declaredAnnotations.values().toArray(EMPTY_ANNOTATIONS_ARRAY);
// }
}

// // Annotations cache
// private transient Map<Class, Annotation> annotations;
Expand Down Expand Up @@ -3539,15 +3539,15 @@ private String cannotCastMsg(Object obj) {
//
// // Annotation types cache their internal (AnnotationType) form
//
// private AnnotationType annotationType;
//
// void setAnnotationType(AnnotationType type) {
// annotationType = type;
// }
//
// AnnotationType getAnnotationType() {
// return annotationType;
// }
private AnnotationType annotationType;

void setAnnotationType(AnnotationType type) {
annotationType = type;
}

AnnotationType getAnnotationType() {
return annotationType;
}

@SuppressWarnings("null")
@Override
Expand Down Expand Up @@ -3592,12 +3592,6 @@ public Object getPackage() {
return null;
}

public XmlRootElement getAnnotation(Class<XmlRootElement> c) {

// TODO Auto-generated method stub
return null;
}

public static Class<?> getJ2SSuperclassFor(Class<?> cl) {
Class<?> c = null;
/**
Expand Down
3 changes: 1 addition & 2 deletions sources/net.sf.j2s.java.core/src/java/text/DigitList.java
Original file line number Diff line number Diff line change
Expand Up @@ -541,8 +541,7 @@ public final void setLong(boolean isNegative, long source, int maximumDigits) {
decimalAt = MAX_COUNT - left;
// Don't copy trailing zeros. We are guaranteed that there is at
// least one non-zero digit, so we don't have to check lower bounds.
for (right = MAX_COUNT - 1; digits[right] == '0'; --right)
;
for (right = MAX_COUNT - 1; digits[right] == '0'; --right) {}
count = right - left + 1;
System.arraycopy(digits, left, digits, 0, count);
}
Expand Down
8 changes: 4 additions & 4 deletions sources/net.sf.j2s.java.core/src/java/util/Spliterator.java
Original file line number Diff line number Diff line change
Expand Up @@ -596,10 +596,10 @@ default Comparator<? super T> getComparator() {
* @see Spliterator.OfDouble
* @since 1.8
*/
public interface OfPrimitive<T, T_CONS, T_SPLITR extends Spliterator.OfPrimitive<T, T_CONS, T_SPLITR>>
public interface OfPrimitive<T, C, S extends Spliterator.OfPrimitive<T, C, S>>
extends Spliterator<T> {
@Override
T_SPLITR trySplit();
S trySplit();

/**
* If a remaining element exists, performs the given action on it,
Expand All @@ -614,7 +614,7 @@ public interface OfPrimitive<T, T_CONS, T_SPLITR extends Spliterator.OfPrimitive
* @throws NullPointerException if the specified action is null
*/
@SuppressWarnings("overloads")
boolean tryAdvance(T_CONS action);
boolean tryAdvance(C action);

/**
* Performs the given action for each remaining element, sequentially in
Expand All @@ -632,7 +632,7 @@ public interface OfPrimitive<T, T_CONS, T_SPLITR extends Spliterator.OfPrimitive
* @throws NullPointerException if the specified action is null
*/
@SuppressWarnings("overloads")
default void forEachRemaining(T_CONS action) {
default void forEachRemaining(C action) {
do { } while (tryAdvance(action));
}
}
Expand Down
34 changes: 34 additions & 0 deletions sources/net.sf.j2s.java.core/src/java/util/Spliterators.java
Original file line number Diff line number Diff line change
Expand Up @@ -862,24 +862,58 @@ private static final class OfRef<T>
extends EmptySpliterator<T, Spliterator<T>, Consumer<? super T>>
implements Spliterator<T> {
OfRef() { }

}

private static final class OfInt
extends EmptySpliterator<Integer, Spliterator.OfInt, IntConsumer>
implements Spliterator.OfInt {
OfInt() { }

/**
* Was necessary for SwingJS
*/
@Override
public boolean tryAdvance(IntConsumer consumer) {
Objects.requireNonNull(consumer);
return false;
}


}

private static final class OfLong
extends EmptySpliterator<Long, Spliterator.OfLong, LongConsumer>
implements Spliterator.OfLong {
OfLong() { }

/**
* Was necessary for SwingJS
*/
@Override
public boolean tryAdvance(LongConsumer consumer) {
Objects.requireNonNull(consumer);
return false;
}


}

private static final class OfDouble
extends EmptySpliterator<Double, Spliterator.OfDouble, DoubleConsumer>
implements Spliterator.OfDouble {
OfDouble() { }

/**
* Was necessary for SwingJS
*/
@Override
public boolean tryAdvance(DoubleConsumer consumer) {
Objects.requireNonNull(consumer);
return false;
}


}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -879,7 +879,7 @@ protected void setJ2sMouseHandler() {
// The DOM attributes applet and _frameViewer are necessary for proper
// direction to the target
J2S.unsetMouse(domNode);
if (domNode == null);
if (domNode == null)// BH GCC found semi here: ;
updateDOMNode();
DOMNode.setAttrs(domNode, "applet", applet, "_frameViewer", jc.getFrameViewer());
J2S.setMouse(domNode, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,9 @@ void handleJSTextEvent(JSTextUI ui, int eventType, Object jqevent) {
} else if (keyCode != KeyEvent.VK_BACK_SPACE){
setCaret = false;
}
if (lastKeyEvent != KeyEvent.KEY_TYPED);// could be lastKeyEvent == 0 ??
if (lastKeyEvent != KeyEvent.KEY_TYPED)
// NOTE there was a ; inserted here commit Id c7fc88f
// could be lastKeyEvent == 0 ??
break;
// fall through if this is a continuation press
case KeyEvent.KEY_RELEASED:
Expand Down
Loading