added test cases for @Root (required test packages refactoring)

This commit is contained in:
Renaud Pawlak 2015-11-24 09:35:25 +01:00
parent 7b990e2b05
commit 986686592b
191 changed files with 481 additions and 391 deletions

View File

@ -169,7 +169,7 @@ public class JSweetContext extends Context {
* Stores the root package namee (i.e. packages contained in the default * Stores the root package namee (i.e. packages contained in the default
* package or in a package annotated with the {@link jsweet.lang.Root} annotation). * package or in a package annotated with the {@link jsweet.lang.Root} annotation).
*/ */
public Set<String> rootPackageNames = new HashSet<>(); public Set<String> topLevelPackageNames = new HashSet<>();
/** /**
* Globally imported name (in the global namespace). * Globally imported name (in the global namespace).

View File

@ -11,7 +11,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.jsweet.transpiler; package org.jsweet.transpiler;
/** /**
@ -240,7 +240,15 @@ public enum JSweetProblem {
/** /**
* Raised when a wildcard import is used. * Raised when a wildcard import is used.
*/ */
WILDCARD_IMPORT(Severity.ERROR); WILDCARD_IMPORT(Severity.ERROR),
/**
* Raised when a @Root package is enclosed in a @Root package.
*/
ENCLOSED_ROOT_PACKAGES(Severity.ERROR),
/**
* Raised when a class is declared in a parent of a @Root package.
*/
CLASS_OUT_OF_ROOT_PACKAGE_SCOPE(Severity.ERROR);
private Severity severity; private Severity severity;
@ -261,7 +269,9 @@ public enum JSweetProblem {
public String getMessage(Object... params) { public String getMessage(Object... params) {
switch (this) { switch (this) {
case JAVA_COMPILER_NOT_FOUND: case JAVA_COMPILER_NOT_FOUND:
return String.format("Java compiler cannot be found: make sure that JAVA_HOME points to a JDK (version>=8) and not a JRE, or sets the transpiler jdkHome option", params); return String.format(
"Java compiler cannot be found: make sure that JAVA_HOME points to a JDK (version>=8) and not a JRE, or sets the transpiler jdkHome option",
params);
case JAVA_ERRORS: case JAVA_ERRORS:
return String.format("Java compiler reports %s error(s) that should be fixed before transpiling", params); return String.format("Java compiler reports %s error(s) that should be fixed before transpiling", params);
case INTERNAL_TSC_ERROR: case INTERNAL_TSC_ERROR:
@ -360,6 +370,10 @@ public enum JSweetProblem {
return String.format("a package name cannot contain top-level keyword(s): %s", params); return String.format("a package name cannot contain top-level keyword(s): %s", params);
case WILDCARD_IMPORT: case WILDCARD_IMPORT:
return String.format("imports cannot use * wildcards: please import a specific element", params); return String.format("imports cannot use * wildcards: please import a specific element", params);
case ENCLOSED_ROOT_PACKAGES:
return String.format("invalid package hierarchy: @Root package %s cannot be enclosed in @Root package %s", params);
case CLASS_OUT_OF_ROOT_PACKAGE_SCOPE:
return String.format("invalid package hierarchy: type %s is declared in a parent of @Root package %s", params);
} }
return null; return null;
} }

View File

@ -673,7 +673,7 @@ public class JSweetTranspiler {
createModuleFile = false; createModuleFile = false;
// create only auxiliary module files on modules within a root // create only auxiliary module files on modules within a root
// package // package
for (String roots : context.rootPackageNames) { for (String roots : context.topLevelPackageNames) {
File root = new File(tsOutputDir, roots.replace('.', File.separatorChar)); File root = new File(tsOutputDir, roots.replace('.', File.separatorChar));
if (rootDir.getPath().startsWith(root.getPath())) { if (rootDir.getPath().startsWith(root.getPath())) {
createModuleFile = true; createModuleFile = true;

View File

@ -146,7 +146,7 @@ public class Java2TypeScriptTranslator extends AbstractTreePrinter {
private boolean globalModule = false; private boolean globalModule = false;
private PackageSymbol rootPackage; private PackageSymbol topLevelPackage;
private void useModule(PackageSymbol targetPackage, JCTree sourceTree, String targetName, String moduleName) { private void useModule(PackageSymbol targetPackage, JCTree sourceTree, String targetName, String moduleName) {
if (context.useModules) { if (context.useModules) {
@ -164,12 +164,34 @@ public class Java2TypeScriptTranslator extends AbstractTreePrinter {
} }
} }
private void checkRootPackageParent(JCCompilationUnit topLevel, PackageSymbol rootPackage, PackageSymbol parentPackage) {
if (parentPackage == null) {
return;
}
if (Util.hasAnnotationType(parentPackage, JSweetConfig.ANNOTATION_ROOT)) {
report(topLevel.getPackageName(), JSweetProblem.ENCLOSED_ROOT_PACKAGES, rootPackage.getQualifiedName().toString(),
parentPackage.getQualifiedName().toString());
}
for (Symbol s : parentPackage.getEnclosedElements()) {
if (!(s instanceof PackageSymbol)) {
report(topLevel.getPackageName(), JSweetProblem.CLASS_OUT_OF_ROOT_PACKAGE_SCOPE, s.getQualifiedName().toString(),
rootPackage.getQualifiedName().toString());
}
}
checkRootPackageParent(topLevel, rootPackage, (PackageSymbol)parentPackage.owner);
}
@Override @Override
public void visitTopLevel(JCCompilationUnit topLevel) { public void visitTopLevel(JCCompilationUnit topLevel) {
printIndent().print("\"Generated from Java with JSweet " + JSweetConfig.getVersionNumber() + " - http://www.jsweet.org\";").println(); printIndent().print("\"Generated from Java with JSweet " + JSweetConfig.getVersionNumber() + " - http://www.jsweet.org\";").println();
rootPackage = Util.getRootPackage(topLevel.packge); PackageSymbol rootPackage = Util.getFirstEnclosingRootPackage(topLevel.packge);
if (rootPackage != null) { if (rootPackage != null) {
context.rootPackageNames.add(rootPackage.getQualifiedName().toString()); checkRootPackageParent(topLevel, rootPackage, (PackageSymbol)rootPackage.owner);
}
topLevelPackage = Util.getTopLevelPackage(topLevel.packge);
if (topLevelPackage != null) {
context.topLevelPackageNames.add(topLevelPackage.getQualifiedName().toString());
} }
footer.delete(0, footer.length()); footer.delete(0, footer.length());
@ -279,7 +301,7 @@ public class Java2TypeScriptTranslator extends AbstractTreePrinter {
if (qualified.sym instanceof ClassSymbol) { if (qualified.sym instanceof ClassSymbol) {
ClassSymbol importedClass = (ClassSymbol) qualified.sym; ClassSymbol importedClass = (ClassSymbol) qualified.sym;
if (Util.isSourceType(importedClass)) { if (Util.isSourceType(importedClass)) {
PackageSymbol targetRootPackage = Util.getRootPackage(importedClass); PackageSymbol targetRootPackage = Util.getTopLevelPackage(importedClass);
if (targetRootPackage == null) { if (targetRootPackage == null) {
continue; continue;
} }
@ -882,7 +904,7 @@ public class Java2TypeScriptTranslator extends AbstractTreePrinter {
public void visitImport(JCImport importDecl) { public void visitImport(JCImport importDecl) {
imports.add(importDecl); imports.add(importDecl);
String qualId = importDecl.getQualifiedIdentifier().toString(); String qualId = importDecl.getQualifiedIdentifier().toString();
if (qualId.endsWith("*")) { if (qualId.endsWith("*") && !qualId.endsWith("." + JSweetConfig.GLOBALS_CLASS_NAME + ".*")) {
report(importDecl, JSweetProblem.WILDCARD_IMPORT); report(importDecl, JSweetProblem.WILDCARD_IMPORT);
return; return;
} }
@ -897,7 +919,7 @@ public class Java2TypeScriptTranslator extends AbstractTreePrinter {
context.registerImportedName(compilationUnit.packge, name); context.registerImportedName(compilationUnit.packge, name);
} }
} else { } else {
if (rootPackage == null) { if (topLevelPackage == null) {
if (context.globalImports.contains(name)) { if (context.globalImports.contains(name)) {
// Tsc global package does allow multiple import with // Tsc global package does allow multiple import with
// the same name in the global namespace (bug?) // the same name in the global namespace (bug?)

View File

@ -11,7 +11,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.jsweet.transpiler.util; package org.jsweet.transpiler.util;
import static java.util.Arrays.asList; import static java.util.Arrays.asList;
@ -385,10 +385,12 @@ public class Util {
} }
/** /**
* Gets root package (see <code>jsweet.lang.Root</code>) enclosing the given * Gets the top-level package enclosing the given symbol. The top-level
* symbol. * package is the one that is enclosed within a root package (see
* <code>jsweet.lang.Root</code>) or the one in the default (unnamed)
* package.
*/ */
public static PackageSymbol getRootPackage(Symbol symbol) { public static PackageSymbol getTopLevelPackage(Symbol symbol) {
if ((symbol instanceof PackageSymbol) && Util.hasAnnotationType(symbol, JSweetConfig.ANNOTATION_ROOT)) { if ((symbol instanceof PackageSymbol) && Util.hasAnnotationType(symbol, JSweetConfig.ANNOTATION_ROOT)) {
return null; return null;
} }
@ -407,11 +409,25 @@ public class Util {
return null; return null;
} }
} else { } else {
return getRootPackage(parent); return getTopLevelPackage(parent);
} }
} }
} }
/**
* Finds the first (including itself) enclosing package annotated
* with @Root.
*/
public static PackageSymbol getFirstEnclosingRootPackage(PackageSymbol packageSymbol) {
if (packageSymbol == null) {
return null;
}
if (Util.hasAnnotationType(packageSymbol, JSweetConfig.ANNOTATION_ROOT)) {
return packageSymbol;
}
return getFirstEnclosingRootPackage((PackageSymbol) packageSymbol.owner);
}
private static void getRootRelativeJavaName(StringBuilder sb, Symbol symbol) { private static void getRootRelativeJavaName(StringBuilder sb, Symbol symbol) {
if (!Util.hasAnnotationType(symbol, JSweetConfig.ANNOTATION_ROOT)) { if (!Util.hasAnnotationType(symbol, JSweetConfig.ANNOTATION_ROOT)) {
if (sb.length() > 0 && !"".equals(symbol.toString())) { if (sb.length() > 0 && !"".equals(symbol.toString())) {
@ -695,7 +711,9 @@ public class Util {
/** /**
* Removes the extensions of the given file name. * Removes the extensions of the given file name.
* @param fileName the given file name (can contain path) *
* @param fileName
* the given file name (can contain path)
* @return the file name without the extension * @return the file name without the extension
*/ */
public static String removeExtension(String fileName) { public static String removeExtension(String fileName) {

View File

@ -17,23 +17,24 @@ package org.jsweet.test.transpiler;
import java.io.File; import java.io.File;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.jsweet.test.transpiler.source.ambient.LibAccess;
import org.jsweet.test.transpiler.source.ambient.LibAccessSubModule;
import org.jsweet.test.transpiler.source.ambient.lib.Base;
import org.jsweet.test.transpiler.source.ambient.lib.Extension;
import org.jsweet.test.transpiler.source.ambient.lib.sub.C;
import org.jsweet.transpiler.ModuleKind; import org.jsweet.transpiler.ModuleKind;
import org.jsweet.transpiler.SourceFile; import org.jsweet.transpiler.SourceFile;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import source.ambient.LibAccess;
import source.ambient.LibAccessSubModule;
import source.ambient.lib.Base;
import source.ambient.lib.Extension;
import source.ambient.lib.sub.C;
public class AmbientTests extends AbstractTest { public class AmbientTests extends AbstractTest {
@Test @Test
public void testLibAccess() throws Exception { public void testLibAccess() throws Exception {
File target = new File(transpiler.getTsOutputDir(), "lib.js"); File target = new File(transpiler.getTsOutputDir(), "lib.js");
FileUtils.deleteQuietly(target); FileUtils.deleteQuietly(target);
FileUtils.copyFile(new File(TEST_DIRECTORY_NAME + "/org/jsweet/test/transpiler/source/ambient/lib.js"), target); FileUtils.copyFile(new File(TEST_DIRECTORY_NAME + "/source/ambient/lib.js"), target);
System.out.println("copied to " + target); System.out.println("copied to " + target);
SourceFile libJs = new SourceFile(null) { SourceFile libJs = new SourceFile(null) {
@ -63,7 +64,7 @@ public class AmbientTests extends AbstractTest {
public void testLibAccessSubModule() throws Exception { public void testLibAccessSubModule() throws Exception {
File target = new File(transpiler.getTsOutputDir(), "libsub.js"); File target = new File(transpiler.getTsOutputDir(), "libsub.js");
FileUtils.deleteQuietly(target); FileUtils.deleteQuietly(target);
FileUtils.copyFile(new File(TEST_DIRECTORY_NAME + "/org/jsweet/test/transpiler/source/ambient/libsub.js"), target); FileUtils.copyFile(new File(TEST_DIRECTORY_NAME + "/source/ambient/libsub.js"), target);
System.out.println("copied to " + target); System.out.println("copied to " + target);
SourceFile libJs = new SourceFile(null) { SourceFile libJs = new SourceFile(null) {

View File

@ -16,16 +16,17 @@ package org.jsweet.test.transpiler;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import org.jsweet.test.transpiler.source.api.CastMethods;
import org.jsweet.test.transpiler.source.api.ForeachIteration;
import org.jsweet.test.transpiler.source.api.JdkInvocations;
import org.jsweet.test.transpiler.source.api.PrimitiveInstantiation;
import org.jsweet.test.transpiler.source.api.QualifiedInstantiation;
import org.jsweet.test.transpiler.source.api.WrongJdkInvocations;
import org.jsweet.transpiler.JSweetProblem; import org.jsweet.transpiler.JSweetProblem;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import source.api.CastMethods;
import source.api.ForeachIteration;
import source.api.JdkInvocations;
import source.api.PrimitiveInstantiation;
import source.api.QualifiedInstantiation;
import source.api.WrongJdkInvocations;
public class ApiTests extends AbstractTest { public class ApiTests extends AbstractTest {
@Test @Test

View File

@ -16,14 +16,15 @@ package org.jsweet.test.transpiler;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import org.jsweet.test.transpiler.source.candies.Angular;
import org.jsweet.test.transpiler.source.candies.ExpressLib;
import org.jsweet.test.transpiler.source.candies.GlobalsImport;
import org.jsweet.test.transpiler.source.candies.JQuery;
import org.jsweet.test.transpiler.source.candies.QualifiedNames;
import org.jsweet.transpiler.ModuleKind; import org.jsweet.transpiler.ModuleKind;
import org.junit.Test; import org.junit.Test;
import source.candies.Angular;
import source.candies.ExpressLib;
import source.candies.GlobalsImport;
import source.candies.JQuery;
import source.candies.QualifiedNames;
public class CandiesTests extends AbstractTest { public class CandiesTests extends AbstractTest {
@Test @Test

View File

@ -16,9 +16,10 @@ package org.jsweet.test.transpiler;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import org.jsweet.test.transpiler.source.generics.InstantiationWithGenerics;
import org.junit.Test; import org.junit.Test;
import source.generics.InstantiationWithGenerics;
public class GenericsTests extends AbstractTest { public class GenericsTests extends AbstractTest {
@Test @Test

View File

@ -19,25 +19,26 @@ import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
import org.jsweet.test.transpiler.source.init.Constructor;
import org.jsweet.test.transpiler.source.init.ConstructorField;
import org.jsweet.test.transpiler.source.init.ConstructorFieldInInterface;
import org.jsweet.test.transpiler.source.init.ConstructorMethod;
import org.jsweet.test.transpiler.source.init.ConstructorMethodInInterface;
import org.jsweet.test.transpiler.source.init.Initializer;
import org.jsweet.test.transpiler.source.init.InitializerStatementConditionError;
import org.jsweet.test.transpiler.source.init.InitializerStatementError;
import org.jsweet.test.transpiler.source.init.InterfaceRawConstruction;
import org.jsweet.test.transpiler.source.init.MultipleMains;
import org.jsweet.test.transpiler.source.init.NoOptionalFieldsInClass;
import org.jsweet.test.transpiler.source.init.StaticInitializer;
import org.jsweet.test.transpiler.source.structural.OptionalField;
import org.jsweet.test.transpiler.source.structural.OptionalFieldError;
import org.jsweet.transpiler.JSweetProblem; import org.jsweet.transpiler.JSweetProblem;
import org.jsweet.transpiler.util.EvaluationResult; import org.jsweet.transpiler.util.EvaluationResult;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import source.init.Constructor;
import source.init.ConstructorField;
import source.init.ConstructorFieldInInterface;
import source.init.ConstructorMethod;
import source.init.ConstructorMethodInInterface;
import source.init.Initializer;
import source.init.InitializerStatementConditionError;
import source.init.InitializerStatementError;
import source.init.InterfaceRawConstruction;
import source.init.MultipleMains;
import source.init.NoOptionalFieldsInClass;
import source.init.StaticInitializer;
import source.structural.OptionalField;
import source.structural.OptionalFieldError;
public class InitTests extends AbstractTest { public class InitTests extends AbstractTest {
@Test @Test

View File

@ -17,13 +17,14 @@ package org.jsweet.test.transpiler;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
import org.jsweet.test.transpiler.source.overload.Overload;
import org.jsweet.test.transpiler.source.overload.WrongOverload;
import org.jsweet.test.transpiler.source.overload.WrongOverloads;
import org.jsweet.transpiler.JSweetProblem; import org.jsweet.transpiler.JSweetProblem;
import org.jsweet.transpiler.util.EvaluationResult; import org.jsweet.transpiler.util.EvaluationResult;
import org.junit.Test; import org.junit.Test;
import source.overload.Overload;
import source.overload.WrongOverload;
import source.overload.WrongOverloads;
public class OverloadTests extends AbstractTest { public class OverloadTests extends AbstractTest {
@Test @Test

View File

@ -17,34 +17,35 @@ package org.jsweet.test.transpiler;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import org.jsweet.test.transpiler.source.blocksgame.Ball;
import org.jsweet.test.transpiler.source.blocksgame.BlockElement;
import org.jsweet.test.transpiler.source.blocksgame.Factory;
import org.jsweet.test.transpiler.source.blocksgame.GameArea;
import org.jsweet.test.transpiler.source.blocksgame.GameManager;
import org.jsweet.test.transpiler.source.blocksgame.Globals;
import org.jsweet.test.transpiler.source.blocksgame.Player;
import org.jsweet.test.transpiler.source.blocksgame.util.AnimatedElement;
import org.jsweet.test.transpiler.source.blocksgame.util.Collisions;
import org.jsweet.test.transpiler.source.blocksgame.util.Direction;
import org.jsweet.test.transpiler.source.blocksgame.util.Line;
import org.jsweet.test.transpiler.source.blocksgame.util.MobileElement;
import org.jsweet.test.transpiler.source.blocksgame.util.Point;
import org.jsweet.test.transpiler.source.blocksgame.util.Rectangle;
import org.jsweet.test.transpiler.source.blocksgame.util.Vector;
import org.jsweet.test.transpiler.source.require.TopLevel1;
import org.jsweet.test.transpiler.source.require.TopLevel2;
import org.jsweet.test.transpiler.source.require.a.A;
import org.jsweet.test.transpiler.source.require.a.Use1;
import org.jsweet.test.transpiler.source.require.a.Use2;
import org.jsweet.test.transpiler.source.require.a.b.B1;
import org.jsweet.test.transpiler.source.require.a.b.B2;
import org.jsweet.test.transpiler.source.require.b.ClassImport;
import org.jsweet.test.transpiler.source.require.b.ClassImportImplicitRequire;
import org.jsweet.test.transpiler.source.require.b.GlobalsImport;
import org.jsweet.transpiler.ModuleKind; import org.jsweet.transpiler.ModuleKind;
import org.junit.Test; import org.junit.Test;
import source.blocksgame.Ball;
import source.blocksgame.BlockElement;
import source.blocksgame.Factory;
import source.blocksgame.GameArea;
import source.blocksgame.GameManager;
import source.blocksgame.Globals;
import source.blocksgame.Player;
import source.blocksgame.util.AnimatedElement;
import source.blocksgame.util.Collisions;
import source.blocksgame.util.Direction;
import source.blocksgame.util.Line;
import source.blocksgame.util.MobileElement;
import source.blocksgame.util.Point;
import source.blocksgame.util.Rectangle;
import source.blocksgame.util.Vector;
import source.require.TopLevel1;
import source.require.TopLevel2;
import source.require.a.A;
import source.require.a.Use1;
import source.require.a.Use2;
import source.require.a.b.B1;
import source.require.a.b.B2;
import source.require.b.ClassImport;
import source.require.b.ClassImportImplicitRequire;
import source.require.b.GlobalsImport;
public class RequireTests extends AbstractTest { public class RequireTests extends AbstractTest {
@Test @Test
@ -81,7 +82,7 @@ public class RequireTests extends AbstractTest {
public void testGlobalsImport() { public void testGlobalsImport() {
transpile(logHandler -> { transpile(logHandler -> {
assertEquals("There should be no errors", 0, logHandler.reportedProblems.size()); assertEquals("There should be no errors", 0, logHandler.reportedProblems.size());
} , getSourceFile(org.jsweet.test.transpiler.source.require.globals.Globals.class), getSourceFile(GlobalsImport.class)); } , getSourceFile(source.require.globals.Globals.class), getSourceFile(GlobalsImport.class));
} }
@Test @Test

View File

@ -0,0 +1,63 @@
/* Copyright 2015 CINCHEO SAS
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jsweet.test.transpiler;
import static org.junit.Assert.assertEquals;
import org.jsweet.transpiler.JSweetProblem;
import org.junit.Assert;
import org.junit.Test;
import source.root.noroot.a.GlobalsInNoRoot;
import source.root.root.a.GlobalsInRoot;
import source.root.rootparent1.InvalidClassLocation;
import source.root.rootparent1.root.NoClassesInRootParent;
import source.root.rootparent2.root.NoRootInRoot;
public class RootTests extends AbstractTest {
@Test
public void testGlobalsInRoot() {
eval((logHandler, r) -> {
assertEquals("There should be no errors", 0, logHandler.reportedProblems.size());
Assert.assertEquals(true, r.get("m1"));
Assert.assertEquals(true, r.get("m2"));
} , getSourceFile(GlobalsInRoot.class));
}
@Test
public void testGlobalsInNoRoot() {
eval((logHandler, r) -> {
assertEquals("There should be no errors", 0, logHandler.reportedProblems.size());
Assert.assertEquals(true, r.get("m1"));
Assert.assertEquals(true, r.get("m2"));
} , getSourceFile(GlobalsInNoRoot.class));
}
@Test
public void testNoClassesInRootParent() {
transpile((logHandler) -> {
logHandler.assertReportedProblems(JSweetProblem.CLASS_OUT_OF_ROOT_PACKAGE_SCOPE);
} , getSourceFile(InvalidClassLocation.class), getSourceFile(NoClassesInRootParent.class));
}
@Test
public void testNoRootInRoot() {
transpile((logHandler) -> {
logHandler.assertReportedProblems(JSweetProblem.ENCLOSED_ROOT_PACKAGES);
} , getSourceFile(NoRootInRoot.class));
}
}

View File

@ -22,38 +22,38 @@ import static org.jsweet.transpiler.JSweetProblem.GLOBAL_INDEXER_SET;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import org.jsweet.test.transpiler.source.structural.AbstractClass;
import org.jsweet.test.transpiler.source.structural.AutoImportClassesInSamePackage;
import org.jsweet.test.transpiler.source.structural.AutoImportClassesInSamePackageUsed;
import org.jsweet.test.transpiler.source.structural.Enums;
import org.jsweet.test.transpiler.source.structural.ExtendsClassInSameFile;
import org.jsweet.test.transpiler.source.structural.ExtendsObject;
import org.jsweet.test.transpiler.source.structural.GlobalsAccess;
import org.jsweet.test.transpiler.source.structural.Inheritance;
import org.jsweet.test.transpiler.source.structural.InnerClass;
import org.jsweet.test.transpiler.source.structural.NameClashes;
import org.jsweet.test.transpiler.source.structural.NoInstanceofForInterfaces;
import org.jsweet.test.transpiler.source.structural.NoWildcardsInImports;
import org.jsweet.test.transpiler.source.structural.TwoClassesInSameFile;
import org.jsweet.test.transpiler.source.structural.WrongConstructsInEnums;
import org.jsweet.test.transpiler.source.structural.WrongConstructsInInterfaces;
import org.jsweet.test.transpiler.source.structural.globalclasses.Globals;
import org.jsweet.test.transpiler.source.structural.globalclasses.a.GlobalsConstructor;
import org.jsweet.test.transpiler.source.structural.globalclasses.b.GlobalFunctionStaticGetSet;
import org.jsweet.test.transpiler.source.structural.globalclasses.c.GlobalFunctionGetSet;
import org.jsweet.test.transpiler.source.structural.globalclasses.d.GlobalFunctionAccessFromMain;
import org.jsweet.test.transpiler.source.structural.globalclasses.f.GlobalFunctionStaticDelete;
import org.jsweet.test.transpiler.source.structural.globalclasses.g.GlobalFunctionDelete;
import org.jsweet.test.transpiler.source.structural.globalclasses.noroot.a.GlobalsInNoRoot;
import org.jsweet.test.transpiler.source.structural.globalclasses.root.a.GlobalsInRoot;
import org.jsweet.test.transpiler.source.structural.rootparent1.InvalidClassLocation;
import org.jsweet.test.transpiler.source.structural.rootparent1.root.NoClassesInRootParent;
import org.jsweet.test.transpiler.source.structural.rootparent2.root.NoRootInRoot;
import org.jsweet.transpiler.JSweetProblem; import org.jsweet.transpiler.JSweetProblem;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import source.root.noroot.a.GlobalsInNoRoot;
import source.root.root.a.GlobalsInRoot;
import source.root.rootparent1.InvalidClassLocation;
import source.root.rootparent1.root.NoClassesInRootParent;
import source.root.rootparent2.root.NoRootInRoot;
import source.structural.AbstractClass;
import source.structural.AutoImportClassesInSamePackage;
import source.structural.AutoImportClassesInSamePackageUsed;
import source.structural.Enums;
import source.structural.ExtendsClassInSameFile;
import source.structural.ExtendsObject;
import source.structural.GlobalsAccess;
import source.structural.Inheritance;
import source.structural.InnerClass;
import source.structural.NameClashes;
import source.structural.NoInstanceofForInterfaces;
import source.structural.NoWildcardsInImports;
import source.structural.TwoClassesInSameFile;
import source.structural.WrongConstructsInEnums;
import source.structural.WrongConstructsInInterfaces;
import source.structural.globalclasses.Globals;
import source.structural.globalclasses.a.GlobalsConstructor;
import source.structural.globalclasses.b.GlobalFunctionStaticGetSet;
import source.structural.globalclasses.c.GlobalFunctionGetSet;
import source.structural.globalclasses.d.GlobalFunctionAccessFromMain;
import source.structural.globalclasses.f.GlobalFunctionStaticDelete;
import source.structural.globalclasses.g.GlobalFunctionDelete;
public class StructuralTests extends AbstractTest { public class StructuralTests extends AbstractTest {
@Test @Test
@ -205,48 +205,14 @@ public class StructuralTests extends AbstractTest {
Assert.assertEquals("invoked", r.get("test")); Assert.assertEquals("invoked", r.get("test"));
Assert.assertEquals("invoked1_2", r.get("Static")); Assert.assertEquals("invoked1_2", r.get("Static"));
Assert.assertEquals("invoked1_2", r.get("test2")); Assert.assertEquals("invoked1_2", r.get("test2"));
} , getSourceFile(Globals.class), getSourceFile(org.jsweet.test.transpiler.source.structural.globalclasses.e.Globals.class), } , getSourceFile(Globals.class), getSourceFile(source.structural.globalclasses.e.Globals.class),
getSourceFile(GlobalFunctionAccessFromMain.class)); getSourceFile(GlobalFunctionAccessFromMain.class));
} }
@Test
public void testGlobalsInRoot() {
eval((logHandler, r) -> {
assertEquals("There should be no errors", 0, logHandler.reportedProblems.size());
Assert.assertEquals(true, r.get("m1"));
Assert.assertEquals(true, r.get("m2"));
} , getSourceFile(GlobalsInRoot.class));
}
@Test
public void testGlobalsInNoRoot() {
eval((logHandler, r) -> {
assertEquals("There should be no errors", 0, logHandler.reportedProblems.size());
Assert.assertEquals(true, r.get("m1"));
Assert.assertEquals(true, r.get("m2"));
} , getSourceFile(GlobalsInNoRoot.class));
}
@Ignore
@Test
public void testNoClassesInRootParent() {
transpile((logHandler) -> {
assertEquals(1, logHandler.reportedProblems.size());
} , getSourceFile(InvalidClassLocation.class), getSourceFile(NoClassesInRootParent.class));
}
@Ignore
@Test
public void testNoRootInRoot() {
transpile((logHandler) -> {
assertEquals(1, logHandler.reportedProblems.size());
} , getSourceFile(NoRootInRoot.class));
}
@Test @Test
public void testWildcardsInImports() { public void testWildcardsInImports() {
transpile((logHandler) -> { transpile((logHandler) -> {
logHandler.assertReportedProblems(JSweetProblem.WILDCARD_IMPORT, JSweetProblem.WILDCARD_IMPORT); logHandler.assertReportedProblems(JSweetProblem.WILDCARD_IMPORT);
} , getSourceFile(NoWildcardsInImports.class)); } , getSourceFile(NoWildcardsInImports.class));
} }

View File

@ -18,22 +18,23 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull; import static org.junit.Assert.assertNull;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
import org.jsweet.test.transpiler.source.syntax.AnnotationQualifiedNames;
import org.jsweet.test.transpiler.source.syntax.FinalVariables;
import org.jsweet.test.transpiler.source.syntax.FinalVariablesRuntime;
import org.jsweet.test.transpiler.source.syntax.GlobalsInvocation;
import org.jsweet.test.transpiler.source.syntax.IndexedAccessInStaticScope;
import org.jsweet.test.transpiler.source.syntax.Keywords;
import org.jsweet.test.transpiler.source.syntax.Labels;
import org.jsweet.test.transpiler.source.syntax.QualifiedNames;
import org.jsweet.test.transpiler.source.syntax.References;
import org.jsweet.test.transpiler.source.syntax.SpecialFunctions;
import org.jsweet.test.transpiler.source.syntax.ValidIndexedAccesses;
import org.jsweet.transpiler.JSweetProblem; import org.jsweet.transpiler.JSweetProblem;
import org.jsweet.transpiler.util.EvaluationResult; import org.jsweet.transpiler.util.EvaluationResult;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import source.syntax.AnnotationQualifiedNames;
import source.syntax.FinalVariables;
import source.syntax.FinalVariablesRuntime;
import source.syntax.GlobalsInvocation;
import source.syntax.IndexedAccessInStaticScope;
import source.syntax.Keywords;
import source.syntax.Labels;
import source.syntax.QualifiedNames;
import source.syntax.References;
import source.syntax.SpecialFunctions;
import source.syntax.ValidIndexedAccesses;
public class SyntaxTests extends AbstractTest { public class SyntaxTests extends AbstractTest {
@Test @Test

View File

@ -16,13 +16,14 @@ package org.jsweet.test.transpiler;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
import org.jsweet.test.transpiler.source.throwable.InvalidTryCatchTest;
import org.jsweet.test.transpiler.source.throwable.TryCatchFinallyTest;
import org.jsweet.transpiler.JSweetProblem; import org.jsweet.transpiler.JSweetProblem;
import org.jsweet.transpiler.util.EvaluationResult; import org.jsweet.transpiler.util.EvaluationResult;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import source.throwable.InvalidTryCatchTest;
import source.throwable.TryCatchFinallyTest;
public class ThrowableTests extends AbstractTest { public class ThrowableTests extends AbstractTest {
@Test @Test

View File

@ -23,8 +23,6 @@ import java.io.File;
import java.util.LinkedList; import java.util.LinkedList;
import org.jsweet.JSweetCommandLineLauncher; import org.jsweet.JSweetCommandLineLauncher;
import org.jsweet.test.transpiler.source.overload.Overload;
import org.jsweet.test.transpiler.source.structural.AbstractClass;
import org.jsweet.transpiler.JSweetTranspiler; import org.jsweet.transpiler.JSweetTranspiler;
import org.jsweet.transpiler.ModuleKind; import org.jsweet.transpiler.ModuleKind;
import org.jsweet.transpiler.SourceFile; import org.jsweet.transpiler.SourceFile;
@ -33,6 +31,9 @@ import org.jsweet.transpiler.util.Util;
import org.junit.Ignore; import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import source.overload.Overload;
import source.structural.AbstractClass;
public class TranspilerTests extends AbstractTest { public class TranspilerTests extends AbstractTest {
@Ignore @Ignore

View File

@ -21,18 +21,19 @@ import static org.junit.Assert.fail;
import java.io.File; import java.io.File;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.jsweet.test.transpiler.source.tscomparison.AbstractClasses;
import org.jsweet.test.transpiler.source.tscomparison.ActualScoping;
import org.jsweet.test.transpiler.source.tscomparison.CompileTimeWarnings;
import org.jsweet.test.transpiler.source.tscomparison.OtherThisExample;
import org.jsweet.test.transpiler.source.tscomparison.SaferVarargs;
import org.jsweet.test.transpiler.source.tscomparison.StrongerTyping;
import org.jsweet.test.transpiler.source.tscomparison.ThisIsThis;
import org.jsweet.transpiler.SourceFile; import org.jsweet.transpiler.SourceFile;
import org.jsweet.transpiler.util.EvaluationResult; import org.jsweet.transpiler.util.EvaluationResult;
import org.junit.Ignore; import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import source.tscomparison.AbstractClasses;
import source.tscomparison.ActualScoping;
import source.tscomparison.CompileTimeWarnings;
import source.tscomparison.OtherThisExample;
import source.tscomparison.SaferVarargs;
import source.tscomparison.StrongerTyping;
import source.tscomparison.ThisIsThis;
public class TsComparisonTest extends AbstractTest { public class TsComparisonTest extends AbstractTest {
@Ignore @Ignore

View File

@ -16,22 +16,23 @@ package org.jsweet.test.transpiler;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
import org.jsweet.test.transpiler.source.typing.ArraysOfLambdas;
import org.jsweet.test.transpiler.source.typing.ClassTypeAsFunction;
import org.jsweet.test.transpiler.source.typing.ClassTypeAsTypeOf;
import org.jsweet.test.transpiler.source.typing.InvalidIndexedAccesses;
import org.jsweet.test.transpiler.source.typing.Lambdas;
import org.jsweet.test.transpiler.source.typing.Numbers;
import org.jsweet.test.transpiler.source.typing.StringTypesUsage;
import org.jsweet.test.transpiler.source.typing.Tuples;
import org.jsweet.test.transpiler.source.typing.Unions;
import org.jsweet.test.transpiler.source.typing.VoidType;
import org.jsweet.test.transpiler.source.typing.WrongUnions;
import org.jsweet.transpiler.JSweetProblem; import org.jsweet.transpiler.JSweetProblem;
import org.jsweet.transpiler.util.EvaluationResult; import org.jsweet.transpiler.util.EvaluationResult;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import source.typing.ArraysOfLambdas;
import source.typing.ClassTypeAsFunction;
import source.typing.ClassTypeAsTypeOf;
import source.typing.InvalidIndexedAccesses;
import source.typing.Lambdas;
import source.typing.Numbers;
import source.typing.StringTypesUsage;
import source.typing.Tuples;
import source.typing.Unions;
import source.typing.VoidType;
import source.typing.WrongUnions;
public class TypingTests extends AbstractTest { public class TypingTests extends AbstractTest {
@Test @Test

View File

@ -16,18 +16,19 @@ package org.jsweet.test.transpiler;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import org.jsweet.test.transpiler.source.varargs.VarargsCalledWithArray;
import org.jsweet.test.transpiler.source.varargs.VarargsOnAnonymous;
import org.jsweet.test.transpiler.source.varargs.VarargsOnApi;
import org.jsweet.test.transpiler.source.varargs.VarargsOnField;
import org.jsweet.test.transpiler.source.varargs.VarargsOnGetter;
import org.jsweet.test.transpiler.source.varargs.VarargsOnNew;
import org.jsweet.test.transpiler.source.varargs.VarargsOnStaticMethod;
import org.jsweet.test.transpiler.source.varargs.VarargsTransmission;
import org.jsweet.transpiler.util.EvaluationResult; import org.jsweet.transpiler.util.EvaluationResult;
import org.junit.Ignore; import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import source.varargs.VarargsCalledWithArray;
import source.varargs.VarargsOnAnonymous;
import source.varargs.VarargsOnApi;
import source.varargs.VarargsOnField;
import source.varargs.VarargsOnGetter;
import source.varargs.VarargsOnNew;
import source.varargs.VarargsOnStaticMethod;
import source.varargs.VarargsTransmission;
public class VarargsTests extends AbstractTest { public class VarargsTests extends AbstractTest {
@Test @Test
@Ignore @Ignore

View File

@ -1,2 +0,0 @@
@jsweet.lang.Root
package org.jsweet.test.transpiler.source.structural.globalclasses.root;

View File

@ -1,5 +0,0 @@
package org.jsweet.test.transpiler.source.structural.rootparent1;
public class InvalidClassLocation {
}

View File

@ -1,5 +0,0 @@
package org.jsweet.test.transpiler.source.structural.rootparent1.root;
public class NoClassesInRootParent {
}

View File

@ -1,2 +0,0 @@
@jsweet.lang.Root
package org.jsweet.test.transpiler.source.structural.rootparent1.root;

View File

@ -1,2 +0,0 @@
@jsweet.lang.Root
package org.jsweet.test.transpiler.source.structural.rootparent2;

View File

@ -1,5 +0,0 @@
package org.jsweet.test.transpiler.source.structural.rootparent2.root;
public class NoRootInRoot {
}

View File

@ -1,2 +0,0 @@
@jsweet.lang.Root
package org.jsweet.test.transpiler.source.structural.rootparent2.root;

View File

@ -12,18 +12,18 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.jsweet.test.transpiler.source.ambient; package source.ambient;
import jsweet.lang.Ambient; import jsweet.lang.Ambient;
public class LibAccess { public class LibAccess {
public static void main(String[] args) { public static void main(String[] args) {
Base m = new org.jsweet.test.transpiler.source.ambient.Base(); Base m = new source.ambient.Base();
m.m1(); m.m1();
//MixinInterface.class.cast(m).extension(); //MixinInterface.class.cast(m).extension();
((org.jsweet.test.transpiler.source.ambient.Extension) m).m2(); ((source.ambient.Extension) m).m2();
//MixinInterface.class.cast(get()).extension(); //MixinInterface.class.cast(get()).extension();

View File

@ -12,18 +12,18 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.jsweet.test.transpiler.source.ambient; package source.ambient;
import org.jsweet.test.transpiler.source.ambient.lib.Base; import source.ambient.lib.Base;
import org.jsweet.test.transpiler.source.ambient.lib.Extension; import source.ambient.lib.Extension;
import org.jsweet.test.transpiler.source.ambient.lib.sub.C; import source.ambient.lib.sub.C;
public class LibAccessSubModule { public class LibAccessSubModule {
public static void main(String[] args) { public static void main(String[] args) {
Base m = new org.jsweet.test.transpiler.source.ambient.lib.Base(); Base m = new source.ambient.lib.Base();
m.m1(); m.m1();
((org.jsweet.test.transpiler.source.ambient.lib.Extension) m).m2(); ((source.ambient.lib.Extension) m).m2();
((Extension) get()).m2(); ((Extension) get()).m2();
} }

View File

@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.jsweet.test.transpiler.source.ambient.lib; package source.ambient.lib;
import jsweet.lang.Ambient; import jsweet.lang.Ambient;

View File

@ -12,12 +12,12 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.jsweet.test.transpiler.source.ambient.lib; package source.ambient.lib;
import jsweet.lang.Ambient; import jsweet.lang.Ambient;
@Ambient @Ambient
// @Interface // @Interface
public class Extension extends org.jsweet.test.transpiler.source.ambient.lib.Base { public class Extension extends source.ambient.lib.Base {
native public void m2(); native public void m2();
} }

View File

@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.jsweet.test.transpiler.source.ambient.lib.sub; package source.ambient.lib.sub;
import jsweet.lang.Ambient; import jsweet.lang.Ambient;

View File

@ -12,5 +12,5 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
@jsweet.lang.Root @jsweet.lang.Root
package org.jsweet.test.transpiler.source.require; package source.ambient;

View File

@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.jsweet.test.transpiler.source.api; package source.api;
import jsweet.lang.Boolean; import jsweet.lang.Boolean;
import jsweet.lang.Number; import jsweet.lang.Number;

View File

@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.jsweet.test.transpiler.source.api; package source.api;
import jsweet.lang.Array; import jsweet.lang.Array;
import jsweet.lang.IArguments; import jsweet.lang.IArguments;

View File

@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.jsweet.test.transpiler.source.api; package source.api;
import static jsweet.util.Globals.$export; import static jsweet.util.Globals.$export;

View File

@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.jsweet.test.transpiler.source.api; package source.api;
import jsweet.lang.Function; import jsweet.lang.Function;
import jsweet.lang.String; import jsweet.lang.String;

View File

@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.jsweet.test.transpiler.source.api; package source.api;
public class QualifiedInstantiation { public class QualifiedInstantiation {

View File

@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.jsweet.test.transpiler.source.api; package source.api;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.util.Iterator; import java.util.Iterator;

View File

@ -12,14 +12,13 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.jsweet.test.transpiler.source.blocksgame; package source.blocksgame;
import org.jsweet.test.transpiler.source.blocksgame.util.MobileElement;
import org.jsweet.test.transpiler.source.blocksgame.util.Point;
import org.jsweet.test.transpiler.source.blocksgame.util.Vector;
import jsweet.dom.CanvasRenderingContext2D; import jsweet.dom.CanvasRenderingContext2D;
import jsweet.lang.Math; import jsweet.lang.Math;
import source.blocksgame.util.MobileElement;
import source.blocksgame.util.Point;
import source.blocksgame.util.Vector;
public class Ball extends MobileElement { public class Ball extends MobileElement {

View File

@ -12,18 +12,17 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.jsweet.test.transpiler.source.blocksgame; package source.blocksgame;
import static jsweet.dom.Globals.document; import static jsweet.dom.Globals.document;
import org.jsweet.test.transpiler.source.blocksgame.util.AnimatedElement;
import org.jsweet.test.transpiler.source.blocksgame.util.Collisions;
import org.jsweet.test.transpiler.source.blocksgame.util.MobileElement;
import org.jsweet.test.transpiler.source.blocksgame.util.Point;
import org.jsweet.test.transpiler.source.blocksgame.util.Vector;
import jsweet.dom.CanvasRenderingContext2D; import jsweet.dom.CanvasRenderingContext2D;
import jsweet.dom.HTMLImageElement; import jsweet.dom.HTMLImageElement;
import source.blocksgame.util.AnimatedElement;
import source.blocksgame.util.Collisions;
import source.blocksgame.util.MobileElement;
import source.blocksgame.util.Point;
import source.blocksgame.util.Vector;
public class BlockElement extends AnimatedElement { public class BlockElement extends AnimatedElement {

View File

@ -12,10 +12,10 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.jsweet.test.transpiler.source.blocksgame; package source.blocksgame;
import org.jsweet.test.transpiler.source.blocksgame.util.Direction; import source.blocksgame.util.Direction;
import org.jsweet.test.transpiler.source.blocksgame.util.Point; import source.blocksgame.util.Point;
public class Factory { public class Factory {

View File

@ -12,17 +12,13 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.jsweet.test.transpiler.source.blocksgame; package source.blocksgame;
import static jsweet.dom.Globals.console; import static jsweet.dom.Globals.console;
import static jsweet.dom.Globals.document; import static jsweet.dom.Globals.document;
import static jsweet.util.Globals.array; import static jsweet.util.Globals.array;
import static jsweet.util.StringTypes._2d; import static jsweet.util.StringTypes._2d;
import org.jsweet.test.transpiler.source.blocksgame.util.Direction;
import org.jsweet.test.transpiler.source.blocksgame.util.Point;
import org.jsweet.test.transpiler.source.blocksgame.util.Rectangle;
import jsweet.dom.CanvasRenderingContext2D; import jsweet.dom.CanvasRenderingContext2D;
import jsweet.dom.Event; import jsweet.dom.Event;
import jsweet.dom.HTMLElement; import jsweet.dom.HTMLElement;
@ -31,6 +27,9 @@ import jsweet.dom.Touch;
import jsweet.dom.TouchEvent; import jsweet.dom.TouchEvent;
import jsweet.lang.Date; import jsweet.lang.Date;
import jsweet.lang.Math; import jsweet.lang.Math;
import source.blocksgame.util.Direction;
import source.blocksgame.util.Point;
import source.blocksgame.util.Rectangle;
public class GameArea { public class GameArea {

View File

@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.jsweet.test.transpiler.source.blocksgame; package source.blocksgame;
import static jsweet.dom.Globals.console; import static jsweet.dom.Globals.console;
import static jsweet.dom.Globals.document; import static jsweet.dom.Globals.document;
@ -22,9 +22,7 @@ import static jsweet.util.StringTypes.mouseup;
import static jsweet.util.StringTypes.touchend; import static jsweet.util.StringTypes.touchend;
import static jsweet.util.StringTypes.touchmove; import static jsweet.util.StringTypes.touchmove;
import static jsweet.util.StringTypes.touchstart; import static jsweet.util.StringTypes.touchstart;
import static org.jsweet.test.transpiler.source.blocksgame.Globals.animate; import static source.blocksgame.Globals.animate;
import org.jsweet.test.transpiler.source.blocksgame.util.Point;
import jsweet.dom.Event; import jsweet.dom.Event;
import jsweet.dom.HTMLCanvasElement; import jsweet.dom.HTMLCanvasElement;
@ -33,6 +31,7 @@ import jsweet.dom.MouseEvent;
import jsweet.dom.NodeList; import jsweet.dom.NodeList;
import jsweet.dom.TouchEvent; import jsweet.dom.TouchEvent;
import jsweet.lang.Math; import jsweet.lang.Math;
import source.blocksgame.util.Point;
public class GameManager { public class GameManager {

View File

@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.jsweet.test.transpiler.source.blocksgame; package source.blocksgame;
import static jsweet.dom.Globals.console; import static jsweet.dom.Globals.console;
import static jsweet.dom.Globals.window; import static jsweet.dom.Globals.window;

View File

@ -12,18 +12,17 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.jsweet.test.transpiler.source.blocksgame; package source.blocksgame;
import static jsweet.dom.Globals.console; import static jsweet.dom.Globals.console;
import org.jsweet.test.transpiler.source.blocksgame.util.Collisions;
import org.jsweet.test.transpiler.source.blocksgame.util.Direction;
import org.jsweet.test.transpiler.source.blocksgame.util.MobileElement;
import org.jsweet.test.transpiler.source.blocksgame.util.Point;
import org.jsweet.test.transpiler.source.blocksgame.util.Vector;
import jsweet.dom.CanvasRenderingContext2D; import jsweet.dom.CanvasRenderingContext2D;
import jsweet.lang.Math; import jsweet.lang.Math;
import source.blocksgame.util.Collisions;
import source.blocksgame.util.Direction;
import source.blocksgame.util.MobileElement;
import source.blocksgame.util.Point;
import source.blocksgame.util.Vector;
public class Player extends MobileElement { public class Player extends MobileElement {

View File

Before

Width:  |  Height:  |  Size: 6.6 KiB

After

Width:  |  Height:  |  Size: 6.6 KiB

View File

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

View File

@ -12,5 +12,5 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
@jsweet.lang.Root @jsweet.lang.Root
package org.jsweet.test.transpiler.source.ambient; package source.blocksgame;

View File

Before

Width:  |  Height:  |  Size: 6.9 KiB

After

Width:  |  Height:  |  Size: 6.9 KiB

View File

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

View File

@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.jsweet.test.transpiler.source.blocksgame.util; package source.blocksgame.util;
import jsweet.dom.CanvasRenderingContext2D; import jsweet.dom.CanvasRenderingContext2D;

View File

@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.jsweet.test.transpiler.source.blocksgame.util; package source.blocksgame.util;
import jsweet.lang.Math; import jsweet.lang.Math;

View File

@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.jsweet.test.transpiler.source.blocksgame.util; package source.blocksgame.util;
import jsweet.lang.Math; import jsweet.lang.Math;

View File

@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.jsweet.test.transpiler.source.blocksgame.util; package source.blocksgame.util;
import jsweet.lang.Error; import jsweet.lang.Error;

View File

@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.jsweet.test.transpiler.source.blocksgame.util; package source.blocksgame.util;
public class MobileElement extends AnimatedElement { public class MobileElement extends AnimatedElement {

View File

@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.jsweet.test.transpiler.source.blocksgame.util; package source.blocksgame.util;
import jsweet.lang.Math; import jsweet.lang.Math;

View File

@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.jsweet.test.transpiler.source.blocksgame.util; package source.blocksgame.util;
import jsweet.lang.Math; import jsweet.lang.Math;

View File

@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.jsweet.test.transpiler.source.blocksgame.util; package source.blocksgame.util;
import jsweet.lang.Math; import jsweet.lang.Math;

View File

@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.jsweet.test.transpiler.source.candies; package source.candies;
import static def.angularjs.Globals.angular; import static def.angularjs.Globals.angular;
import static jsweet.util.Globals.array; import static jsweet.util.Globals.array;

View File

@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.jsweet.test.transpiler.source.candies; package source.candies;
import static def.body_parser.body_parser.Globals.json; import static def.body_parser.body_parser.Globals.json;
import static def.body_parser.body_parser.Globals.urlencoded; import static def.body_parser.body_parser.Globals.urlencoded;

View File

@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.jsweet.test.transpiler.source.candies; package source.candies;
import static def.body_parser.body_parser.Globals.json; import static def.body_parser.body_parser.Globals.json;
import static def.body_parser.body_parser.Globals.urlencoded; import static def.body_parser.body_parser.Globals.urlencoded;

View File

@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.jsweet.test.transpiler.source.candies; package source.candies;
import static def.jquery.Globals.$; import static def.jquery.Globals.$;

View File

@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.jsweet.test.transpiler.source.candies; package source.candies;
import static def.socket_io.Globals.socket_io; import static def.socket_io.Globals.socket_io;

View File

@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.jsweet.test.transpiler.source.generics; package source.generics;
@SuppressWarnings("unused") @SuppressWarnings("unused")
public class InstantiationWithGenerics<T, V> { public class InstantiationWithGenerics<T, V> {
@ -27,8 +27,8 @@ public class InstantiationWithGenerics<T, V> {
public static void main(String[] args) { public static void main(String[] args) {
InstantiationWithGenerics<String, Integer> foo = new InstantiationWithGenerics<String, Integer>("lolo", 4); InstantiationWithGenerics<String, Integer> foo = new InstantiationWithGenerics<String, Integer>("lolo", 4);
org.jsweet.test.transpiler.source.generics.InstantiationWithGenerics<String, Integer> bar source.generics.InstantiationWithGenerics<String, Integer> bar
= new org.jsweet.test.transpiler.source.generics.InstantiationWithGenerics<String, Integer>("lolo", 4); = new source.generics.InstantiationWithGenerics<String, Integer>("lolo", 4);
C<String> c = new C<String>(); C<String> c = new C<String>();
} }
} }

View File

@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.jsweet.test.transpiler.source.init; package source.init;
public class Constructor { public class Constructor {

View File

@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.jsweet.test.transpiler.source.init; package source.init;
public class ConstructorField { public class ConstructorField {

View File

@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.jsweet.test.transpiler.source.init; package source.init;
import jsweet.lang.Interface; import jsweet.lang.Interface;

View File

@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.jsweet.test.transpiler.source.init; package source.init;
public class ConstructorMethod { public class ConstructorMethod {

View File

@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.jsweet.test.transpiler.source.init; package source.init;
import jsweet.lang.Interface; import jsweet.lang.Interface;

View File

@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.jsweet.test.transpiler.source.init; package source.init;
import static jsweet.util.Globals.$export; import static jsweet.util.Globals.$export;

View File

@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.jsweet.test.transpiler.source.init; package source.init;
import jsweet.lang.Interface; import jsweet.lang.Interface;

View File

@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.jsweet.test.transpiler.source.init; package source.init;
import jsweet.lang.Interface; import jsweet.lang.Interface;

View File

@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.jsweet.test.transpiler.source.init; package source.init;
import jsweet.lang.Interface; import jsweet.lang.Interface;

View File

@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.jsweet.test.transpiler.source.init; package source.init;
import jsweet.lang.Disabled; import jsweet.lang.Disabled;
import static jsweet.util.Globals.$export; import static jsweet.util.Globals.$export;

View File

@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.jsweet.test.transpiler.source.init; package source.init;
import jsweet.lang.Optional; import jsweet.lang.Optional;

View File

@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.jsweet.test.transpiler.source.init; package source.init;
import static jsweet.util.Globals.$export; import static jsweet.util.Globals.$export;

View File

@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.jsweet.test.transpiler.source.overload; package source.overload;
import static jsweet.util.Globals.$export; import static jsweet.util.Globals.$export;

View File

@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.jsweet.test.transpiler.source.overload; package source.overload;
public class WrongOverload { public class WrongOverload {

View File

@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.jsweet.test.transpiler.source.overload; package source.overload;
public class WrongOverloads { public class WrongOverloads {

View File

@ -12,9 +12,9 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.jsweet.test.transpiler.source.require; package source.require;
import org.jsweet.test.transpiler.source.require.a.A; import source.require.a.A;
public class TopLevel1 { public class TopLevel1 {

View File

@ -12,9 +12,9 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.jsweet.test.transpiler.source.require; package source.require;
import org.jsweet.test.transpiler.source.require.a.A; import source.require.a.A;
public class TopLevel2 { public class TopLevel2 {

View File

@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.jsweet.test.transpiler.source.require.a; package source.require.a;
import static jsweet.util.Globals.$export; import static jsweet.util.Globals.$export;

View File

@ -12,9 +12,9 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.jsweet.test.transpiler.source.require.a; package source.require.a;
import org.jsweet.test.transpiler.source.require.a.b.B1; import source.require.a.b.B1;
public class Use1 { public class Use1 {

View File

@ -12,9 +12,9 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.jsweet.test.transpiler.source.require.a; package source.require.a;
import org.jsweet.test.transpiler.source.require.a.b.B1; import source.require.a.b.B1;
public class Use2 { public class Use2 {

View File

@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.jsweet.test.transpiler.source.require.a.b; package source.require.a.b;
import static jsweet.util.Globals.$export; import static jsweet.util.Globals.$export;

View File

@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.jsweet.test.transpiler.source.require.a.b; package source.require.a.b;
import static jsweet.util.Globals.$export; import static jsweet.util.Globals.$export;

View File

@ -12,11 +12,11 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.jsweet.test.transpiler.source.require.b; package source.require.b;
import static jsweet.util.Globals.$export; import static jsweet.util.Globals.$export;
import org.jsweet.test.transpiler.source.require.a.A; import source.require.a.A;
public class ClassImport { public class ClassImport {

View File

@ -12,16 +12,15 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.jsweet.test.transpiler.source.require.b; package source.require.b;
import static def.express.Globals.express; import static def.express.Globals.express;
import static jsweet.util.Globals.$export; import static jsweet.util.Globals.$export;
import org.jsweet.test.transpiler.source.require.a.A;
import org.jsweet.test.transpiler.source.require.a.b.B1;
import org.jsweet.test.transpiler.source.require.a.b.B2;
import def.express.express.Express; import def.express.express.Express;
import source.require.a.A;
import source.require.a.b.B1;
import source.require.a.b.B2;
public class ClassImportImplicitRequire { public class ClassImportImplicitRequire {

View File

@ -12,12 +12,12 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.jsweet.test.transpiler.source.require.b; package source.require.b;
import static jsweet.dom.Globals.console; import static jsweet.dom.Globals.console;
import static org.jsweet.test.transpiler.source.require.globals.Globals.animate; import static source.require.globals.Globals.animate;
import org.jsweet.test.transpiler.source.require.globals.Globals; import source.require.globals.Globals;
public class GlobalsImport { public class GlobalsImport {

View File

@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.jsweet.test.transpiler.source.require.globals; package source.require.globals;
import static jsweet.dom.Globals.window; import static jsweet.dom.Globals.window;

View File

@ -13,4 +13,4 @@
* limitations under the License. * limitations under the License.
*/ */
@jsweet.lang.Root @jsweet.lang.Root
package org.jsweet.test.transpiler.source.blocksgame; package source.require;

View File

@ -1,7 +1,7 @@
package org.jsweet.test.transpiler.source.structural.globalclasses.noroot.a; package source.root.noroot.a;
import static jsweet.util.Globals.$export; import static jsweet.util.Globals.$export;
import static org.jsweet.test.transpiler.source.structural.globalclasses.noroot.a.Globals.m2; import static source.root.noroot.a.Globals.m2;
public class GlobalsInNoRoot { public class GlobalsInNoRoot {

View File

@ -1,7 +1,7 @@
package org.jsweet.test.transpiler.source.structural.globalclasses.root.a; package source.root.root.a;
import static jsweet.util.Globals.$export; import static jsweet.util.Globals.$export;
import static org.jsweet.test.transpiler.source.structural.globalclasses.root.a.Globals.m2; import static source.root.root.a.Globals.m2;
public class GlobalsInRoot { public class GlobalsInRoot {

View File

@ -0,0 +1,2 @@
@jsweet.lang.Root
package source.root.root;

View File

@ -0,0 +1,5 @@
package source.root.rootparent1;
public class InvalidClassLocation {
}

View File

@ -0,0 +1,5 @@
package source.root.rootparent1.root;
public class NoClassesInRootParent {
}

Some files were not shown because too many files have changed in this diff Show More