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
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 @@
20191208152303
20191215102844
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 @@
20191208152303
20191215102844
6 changes: 4 additions & 2 deletions sources/net.sf.j2s.core/src/net/sf/j2s/core/CorePlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ 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-v2";
// BH 2019.12.06 -- 3.2.5.v2 fix for try(resources) not closing those
public static String VERSION = "3.2.5-v4";
// BH 2019.12.15 -- 3.2.5-v4 fix for local class within anonymous class not getting name
// BH 2019.12.12 -- 3.2.5-v3 fix for enums == null in annotations
// BH 2019.12.06 -- 3.2.5-v2 fix for try(resources) not closing those
// 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
69 changes: 46 additions & 23 deletions sources/net.sf.j2s.core/src/net/sf/j2s/core/Java2ScriptVisitor.java
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,11 @@
// HashSet as the basis for the {a:a,b:this.$finals$.b} mapping listFinalVariables.
// This fixed all of the stream issues. See Test_Local, Test_java8, Test_Class.

// BH 2019.12.07 3.2.5-v2 fix for lambda expression with $$ must not be cached
// BH 2019.12.15 3.2.5-v4 fix for <? extends Byte> not getting name for boxing
// BH 2019.12.15 3.2.5-v4 fix for local class within anonymous class not getting name
// BH 2019.12.12 3.2.5-v3 fix for enums == null in annotations
// BH 2019.12.07 3.2.5-v3 fix for lambda expression with $$ must not be cached
// BH 2019.12.06 3.2.5-v2 fix for try(resources) not closing those
// BH 2019.11.18 3.2.5-v0 fix for anonymous subclass of a local class not handling finals
// BH 2019.11.18 3.2.5-v0 fix for main method that throws exception not generating html test
// BH 2019.11.18 3.2.5-v0 fix for lambda expressions in classes with annotations
Expand Down Expand Up @@ -4437,12 +4441,18 @@ private boolean appendBoxingNode(ASTNode element, boolean toCharCode) {
// expression is the site of an unboxing conversion
ITypeBinding typeBinding = exp.resolveTypeBinding();
if (!typeBinding.isPrimitive()) {
String name = getJavaClassNameQualified(typeBinding);
name = (name.indexOf("Integer") >= 0 ? "int"
: name.indexOf("Character") >= 0 ? "char" : name.replace("java.lang.", "").toLowerCase());
buffer.append("(");
element.accept(this);
buffer.append(toCharCode && name == "char" ? ")" + CHARCODEAT0 : ")." + name + "Value$()");
if (toCharCode) {
String name = getJavaClassNameQualified(typeBinding);
if (toCharCode && name.length() == 0)
name = typeBinding.getKey();
if (name.indexOf("Character") >= 0) {
buffer.append(").intValue$()");
return true;
}
}
buffer.append(").valueOf()");
return true;
}
}
Expand Down Expand Up @@ -4495,11 +4505,22 @@ static String getJavaClassNameQualified(ITypeBinding binding) {

if (binding == null)
return null;
String binaryName = null, bindingKey;
if ((binding.isAnonymous() || binding.isLocal()) && (binaryName = binding.getBinaryName()) == null
String name = null, bindingKey;
if ((binding.isAnonymous() || binding.isLocal()) && (name = binding.getBinaryName()) == null
&& (bindingKey = binding.getKey()) != null)
binaryName = bindingKey.substring(1, bindingKey.length() - 1).replace('/', '.');
return (binaryName == null ? binding.getQualifiedName() : binaryName);
name = bindingKey.substring(1, bindingKey.length() - 1).replace('/', '.');
if (name == null) {
name = binding.getQualifiedName();
if (name.length() == 0) {
name = binding.getBinaryName();
if (name == null) {
System.out.println(">>name null?? bn=" + binding.getBinaryName() + " qn=" + binding.getQualifiedName() + " n=" + binding.getName() + " k=" +binding.getKey()
+ " isAnon" + binding.isAnonymous() + " " + binding.isLocal());
name = ""; // <? extends Byte>
}
}
}
return name;
}

private static String getJavaClassNameSuperNoBrackets(ITypeBinding typeBinding) {
Expand Down Expand Up @@ -4721,25 +4742,22 @@ String getFinalJ2SClassNameQualifier(Name methodQualifier, ITypeBinding declarin
* $I$[] dynamic class loading and interfaces, (but interfaces are handled
* differently).
*
* This is a temporary will fix and will fail if the program does not adhere to
* class/package-capitalization standards.
*
* @param packageName Java package name or "_"
* @param javaClassName
* @return array listing classes that need to be loaded in order
*/
private String getFinalInnerClassList(ITypeBinding javaClass, String javaClassName) {
if (javaClassName == null)
String packageName = getPackageName(javaClass);
if (javaClassName == null) {
javaClassName = getJavaClassNameQualified(javaClass);
// called by addClassOrInterface and getFinalClazzLoadI
System.out.println(">>jcn was null! " + javaClassName);
// } else if (javaClassName.length() == 0) {
// // local inner class within an anonymous class
// javaClassName = javaClass.getBinaryName();
}
if (javaClassName.indexOf("$lambda") >= 0)
return "'" + getFinalJ2SClassName(javaClassName, FINAL_RAW) + "'";
String name = removeBracketsAndFixNullPackageName(javaClassName);
String packageName = getPackageName(javaClass);
// if (name.indexOf(packageName) != 0) {
// dumpStack("???? packageName " + packageName + " " + name);
// }
name = name.substring(packageName.length() + 1);
String name = removeBracketsAndFixNullPackageName(javaClassName).substring(packageName.length() + 1);
String[] parts = name.split("\\.");
String s = packageName + "." + parts[0];
int len = parts.length;
Expand Down Expand Up @@ -5780,10 +5798,12 @@ private void addDummyClassForPackageOnlyFile() {
}

public boolean visit(AnnotationTypeDeclaration node) {
System.out.println(">>AnnotationTypeDecl " + node);
return false;
}

public boolean visit(AnnotationTypeMemberDeclaration node) {
System.out.println(">>AnnotationTypeMembDecl " + node);
return false;
}

Expand Down Expand Up @@ -6414,7 +6434,8 @@ public static void addClassAnnotations(int accessType, List<ClassAnnotation> cla
type = ((TypeDeclaration) a.node).resolveBinding();
} else if (a.node instanceof FieldDeclaration) {
FieldDeclaration field = (FieldDeclaration) a.node;
fields.remove(field);
if (fields != null)
fields.remove(field);
fragments = field.fragments();
VariableDeclarationFragment identifier = (VariableDeclarationFragment) fragments.get(0);
IVariableBinding var = identifier.resolveBinding();
Expand All @@ -6423,7 +6444,8 @@ public static void addClassAnnotations(int accessType, List<ClassAnnotation> cla
} else if (a.node instanceof MethodDeclaration) {
MethodDeclaration method = (MethodDeclaration) a.node;
IMethodBinding var = method.resolveBinding();
if (methods.contains(var))
if (methods != null)
if (methods.contains(var))
methods.remove(var);
if (accessType != TEST_TYPE)
var = getJAXBGetMethod(var, methods, false);
Expand All @@ -6433,7 +6455,8 @@ public static void addClassAnnotations(int accessType, List<ClassAnnotation> cla
type = var.getReturnType();
} else if (a.node instanceof EnumConstantDeclaration) {
EnumConstantDeclaration con = (EnumConstantDeclaration) a.node;
enums.remove(con);
if (enums != null)
enums.remove(con);
IVariableBinding var = con.resolveVariable();
varName = var.getName();
type = var.getType();
Expand Down
Binary file modified sources/net.sf.j2s.java.core/dist/SwingJS-site.zip
Binary file not shown.
12 changes: 6 additions & 6 deletions sources/net.sf.j2s.java.core/src/java/awt/image/DataBuffer.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,12 @@ public abstract class DataBuffer {
/** Tag for int data. */
public static final int TYPE_INT = 3;

// /** Tag for float data. Placeholder for future use. */
// public static final int TYPE_FLOAT = 4;
//
// /** Tag for double data. Placeholder for future use. */
// public static final int TYPE_DOUBLE = 5;
//
/** Tag for float data. Placeholder for future use. */
public static final int TYPE_FLOAT = 4;

/** Tag for double data. Placeholder for future use. */
public static final int TYPE_DOUBLE = 5;

/** Tag for undefined data. */
public static final int TYPE_UNDEFINED = 32;

Expand Down
Loading