Skip to content

Commit

Permalink
Migrate all javaemul.internal to user
Browse files Browse the repository at this point in the history
Change-Id: I4121c7979552043bce654f6ea418f1519e3d51c4
  • Loading branch information
gkdn committed Mar 7, 2016
1 parent 0ee0798 commit f1381ca
Show file tree
Hide file tree
Showing 28 changed files with 36 additions and 55 deletions.
9 changes: 0 additions & 9 deletions dev/BUILD
Expand Up @@ -216,7 +216,6 @@ java_library(
exclude = [
"core/super/com/google/gwt/dev/jjs/intrinsic/**",
"**/package-info.java",
"**/EmulatedCharset.java",
],
),
compatible_with = ["//buildenv/target:android"],
Expand Down Expand Up @@ -339,11 +338,3 @@ GwtTestSuites(
tests = GWT_DEV_TESTS,
deps = [":dev-test-code"],
)

filegroup(
name = "emul",
srcs = glob([
"core/super/javaemul/**/*.java",
]),
visibility = ["//third_party/java_src/j2cl:__subpackages__"],
)
7 changes: 4 additions & 3 deletions dev/build.xml
Expand Up @@ -32,8 +32,9 @@
<pathelement location="${gwt.tools.lib}/junit/junit-4.8.2.jar"/>
</classpath>
</gwt.javac>
<gwt.javac srcdir="${gwt.root}/user/src" destdir="${javac.junit.out}"
excludes="**/super/**">
<gwt.javac srcdir="" destdir="${javac.junit.out}" excludes="**/EmulatedCharset.java">
<src path="${gwt.root}/user/src" />
<src path="${gwt.root}/user/super/com/google/gwt/emul/javaemul/internal"/>
<classpath>
<pathelement location="${javac.out}"/>
<pathelement location="${gwt.tools.lib}/gss/2015-11-04/closure-stylesheets-library-20151104-rebased.jar"/>
Expand Down Expand Up @@ -175,7 +176,7 @@
<target name="compiler.standalone"
description="Validates that the standalone gwt-compiler project can build.">
<mkdir dir="${javac.out}"/>
<gwt.javac srcdir="core/super" excludes="com/google/gwt/dev/jjs/intrinsic/,**/EmulatedCharset.java"/>
<gwt.javac srcdir="core/super" excludes="com/google/gwt/dev/jjs/intrinsic/"/>
<gwt.javac srcdir="core/src">
<include name="com/google/gwt/core/ext/**"/>
<include name="com/google/gwt/core/linker/**"/>
Expand Down
11 changes: 4 additions & 7 deletions dev/core/src/com/google/gwt/dev/jjs/impl/GwtAstBuilder.java
Expand Up @@ -237,9 +237,6 @@
import java.util.Map.Entry;
import java.util.Set;

import javaemul.internal.annotations.DoNotInline;
import javaemul.internal.annotations.ForceInline;

/**
* Constructs a GWT Java AST from a single isolated compilation unit. The AST is
* not associated with any {@link com.google.gwt.dev.jjs.ast.JProgram} and will
Expand Down Expand Up @@ -4090,11 +4087,11 @@ private void processSuppressedWarnings(CanHaveSuppressedWarnings x, Annotation..
x.setSuppressedWarnings(JdtUtil.getSuppressedWarnings(annotations));
}

private void maybeSetInliningMode(AbstractMethodDeclaration x,
JMethod method) {
if (JdtUtil.getAnnotation(x.binding, DoNotInline.class.getCanonicalName()) != null) {
private void maybeSetInliningMode(AbstractMethodDeclaration x, JMethod method) {
MethodBinding bind = x.binding;
if (JdtUtil.getAnnotation(bind, "javaemul.internal.annotations.DoNotInline") != null) {
method.setInliningMode(InliningMode.DO_NOT_INLINE);
} else if (JdtUtil.getAnnotation(x.binding, ForceInline.class.getCanonicalName()) != null) {
} else if (JdtUtil.getAnnotation(bind, "javaemul.internal.annotations.ForceInline") != null) {
method.setInliningMode(InliningMode.FORCE_INLINE);
}
}
Expand Down
10 changes: 0 additions & 10 deletions dev/core/super/com/google/gwt/lang/BigLongLibBase.java
Expand Up @@ -15,8 +15,6 @@
*/
package com.google.gwt.lang;

import com.google.gwt.core.client.UnsafeNativeLong;

/**
* Implements a Java <code>long</code> in a way that can be translated to
* JavaScript.
Expand Down Expand Up @@ -65,14 +63,6 @@ static class BigLong {
protected static final double TWO_PWR_63_DBL = TWO_PWR_32_DBL
* TWO_PWR_31_DBL;

/**
* Production Mode implementation; the int array is already the right object.
*/
@UnsafeNativeLong
protected static native long asLong(BigLong value) /*-{
return value;
}-*/;

protected static BigLong create(int value) {
int a0 = value & MASK;
int a1 = (value >> BITS) & MASK;
Expand Down
Expand Up @@ -26,8 +26,6 @@
import com.google.gwt.dev.jjs.ast.JVisitor;
import com.google.gwt.dev.jjs.impl.EnumOrdinalizer.Tracker;

import javaemul.internal.annotations.DoNotInline;

/**
* A set of tests for the conditions under which ordinalization is and is not allowed. The
* ordinalization is performed when allowed.
Expand Down Expand Up @@ -1033,7 +1031,7 @@ private void setupFruitEnumWithStaticField() {
}

private void setupFruitEnumWithStaticMethod() {
addSnippetImport(DoNotInline.class.getCanonicalName());
addSnippetImport("javaemul.internal.annotations.DoNotInline");
addSnippetClassDecl("public enum Fruit {APPLE, ORANGE;",
" @DoNotInline",
" public static final int staticMethod() {",
Expand Down
Expand Up @@ -17,8 +17,6 @@
import com.google.gwt.dev.jjs.ast.JMethod;
import com.google.gwt.dev.jjs.ast.JProgram;

import javaemul.internal.annotations.DoNotInline;

/**
* Test for {@link MethodInliner}.
*/
Expand All @@ -39,7 +37,7 @@ public void testNoMethodCall() throws Exception {
}

public void testLocalVariables() throws Exception {
addSnippetImport(DoNotInline.class.getCanonicalName());
addSnippetImport("javaemul.internal.annotations.DoNotInline");
addSnippetClassDecl("static int fun() { int a = 1; return a; }");
addSnippetClassDecl("@DoNotInline static int caller() { return fun(); }");
Result result = optimize("int", "return caller();");
Expand All @@ -48,7 +46,7 @@ public void testLocalVariables() throws Exception {
}

public void testLocalVariables_unassignedAtDefinition() throws Exception {
addSnippetImport(DoNotInline.class.getCanonicalName());
addSnippetImport("javaemul.internal.annotations.DoNotInline");
addSnippetClassDecl("static int fun() { int a; return a = 1; }");
addSnippetClassDecl("@DoNotInline static int caller() { return fun(); }");
Result result = optimize("int", "return caller();");
Expand All @@ -57,7 +55,7 @@ public void testLocalVariables_unassignedAtDefinition() throws Exception {
}

public void testLocalVariablesUnusedReturn() throws Exception {
addSnippetImport(DoNotInline.class.getCanonicalName());
addSnippetImport("javaemul.internal.annotations.DoNotInline");
addSnippetClassDecl("static int fun() { int a = 1; return a; }");
addSnippetClassDecl("@DoNotInline static int caller() { fun(); return 1; }");
Result result = optimize("int", "return caller();");
Expand Down
34 changes: 21 additions & 13 deletions user/BUILD
Expand Up @@ -60,10 +60,13 @@ AugmentedJar(
java_library(
name = "gwt-user-bare",
srcs = glob(
["src/**/*.java"],
[
"src/**/*.java",
"super/com/google/gwt/emul/javaemul/internal/**/*.java",
],
exclude = [
"src/com/google/gwt/junit/**/*.java", # see gwt-testing
"**/super/**",
"**/EmulatedCharset.java",
"**/RunStyleSelenium.java",
],
),
Expand Down Expand Up @@ -343,8 +346,6 @@ java_library(
"src/com/google/gwt/user/client/impl/WindowImpl.java",
"src/com/google/gwt/dom/client/*.java",
"src/com/google/gwt/core/client/impl/Impl.java",
"src/com/google/gwt/core/client/impl/Disposable.java",
"src/com/google/gwt/core/client/impl/UnloadSupport.java",
"src/com/google/gwt/core/client/impl/StackTraceCreator.java",
"src/com/google/gwt/core/client/impl/SchedulerImpl.java",
"src/com/google/gwt/core/client/impl/AsyncFragmentLoader.java",
Expand All @@ -359,12 +360,13 @@ java_library(
"src/com/google/gwt/i18n/client/impl/*.java",
"src/com/google/gwt/i18n/client/*.java",
"src/com/google/gwt/i18n/rebind/keygen/*.java",
"super/com/google/gwt/emul/javaemul/internal/ArrayHelper.java",
"super/com/google/gwt/emul/javaemul/internal/ArrayStamper.java",
# And it's also sensible to want for serialization:
"src/com/google/gwt/user/client/ui/SuggestOracle.java",
],
exclude = [
"**/junit/**",
"**/super/**",
"**/package-info.java",
"src/com/google/web/bindery/requestfactory/server/RequestFactoryJarExtractor.java",
],
Expand Down Expand Up @@ -641,24 +643,30 @@ filegroup(
)

filegroup(
name = "emul",
srcs = glob(
[
"super/com/google/gwt/emul/java/**/*.java",
],
),
name = "java_emul",
srcs = glob(["super/com/google/gwt/emul/java/**/*.java"]),
visibility = ["//third_party/java_src/j2cl:__subpackages__"],
)

filegroup(
name = "java_emul_internal",
srcs = glob(["super/com/google/gwt/emul/javaemul/**/*.java"]),
visibility = ["//third_party/java_src/j2cl:__subpackages__"],
)

filegroup(
name = "emul_test",
name = "java_emul_test",
srcs = glob(
[
"test/com/google/gwt/emultest/**/*.java",
"test/com/google/gwt/testing/TestUtils.java",
"test/org/apache/commons/**/*.java",
],
exclude = ["**/package-info.java"],
exclude = [
"test/**/java8/**",
"test/**/*Java8Suite.java",
"**/package-info.java",
],
),
visibility = ["//third_party/java_src/j2cl:__subpackages__"],
)
3 changes: 2 additions & 1 deletion user/build.xml
Expand Up @@ -104,7 +104,8 @@
<target name="compile" description="Compile all class files"
unless="compile.complete">
<mkdir dir="${javac.out}"/>
<gwt.javac excludes="**/super/**">
<gwt.javac excludes="**/EmulatedCharset.java">
<src path="super/com/google/gwt/emul/javaemul/internal"/>
<classpath>
<pathelement location="${gwt.tools.lib}/gss/2015-10-07/closure-stylesheets-library-20151007-rebased.jar"/>
<pathelement location="${gwt.tools.lib}/gss/2015-11-04/closure-stylesheets-library-20151104-rebased.jar"/>
Expand Down
4 changes: 1 addition & 3 deletions user/src/com/google/gwt/core/client/JavaScriptObject.java
Expand Up @@ -15,8 +15,6 @@
*/
package com.google.gwt.core.client;

import javaemul.internal.HashCodes;

/**
* An opaque handle to a native JavaScript object. A
* <code>JavaScriptObject</code> cannot be created directly.
Expand Down Expand Up @@ -148,7 +146,7 @@ public final boolean equals(Object other) {
*/
@Override
public final int hashCode() {
return HashCodes.getObjectIdentityHashCode(this);
return super.hashCode();
}

/**
Expand Down
1 change: 0 additions & 1 deletion user/super/com/google/gwt/emul/Emulation.gwt.xml
Expand Up @@ -15,7 +15,6 @@
<!-- A JavaScript-based emulation of the Java Runtime library. -->
<!-- Do not inherit this module directly; inherit com.google.gwt.core.Core. -->
<module>
<inherits name="javaemul.internal.Internal"/>
<inherits name="com.google.gwt.emul.Preconditions" />

<extend-configuration-property name="compiler.enum.obfuscate.names.blacklist"
Expand Down

0 comments on commit f1381ca

Please sign in to comment.