Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests for @JsExport and @jstype on Enum type.
Change-Id: Iace8a165d4679f22918822a575e713024075a2c7
- Loading branch information
Ye Wang
committed
Feb 19, 2015
1 parent
ffeca5d
commit b2f480c
Showing
8 changed files
with
342 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
user/test/com/google/gwt/core/client/interop/MyEnumWithJsExport.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
* Copyright 2015 Google Inc. | ||
* | ||
* 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 com.google.gwt.core.client.interop; | ||
|
||
import com.google.gwt.core.client.js.JsExport; | ||
|
||
/** | ||
* This enum is annotated as @JsExport. | ||
*/ | ||
@JsExport | ||
public enum MyEnumWithJsExport { | ||
TEST1, TEST2; | ||
|
||
public static int publicStaticMethod() { | ||
return 0; | ||
} | ||
|
||
public static final int publicStaticFinalField = 1; | ||
|
||
// explicitly marked @JsExport fields must be final | ||
// but ones that are in a @JsExported class don't need to be final | ||
public static int publicStaticField = 2; | ||
|
||
public final int publicFinalField = 3; | ||
|
||
private static final int privateStaticFinalField = 4; | ||
|
||
protected static final int protectedStaticFinalField = 5; | ||
|
||
static final int defaultStaticFinalField = 6; | ||
|
||
public int publicMethod() { | ||
return 0; | ||
} | ||
|
||
protected static int protectedStaticMethod() { | ||
return 0; | ||
} | ||
|
||
static int defaultStaticMethod() { | ||
return 0; | ||
} | ||
|
||
private static int privateStaticMethod() { | ||
return 0; | ||
} | ||
} |
61 changes: 61 additions & 0 deletions
61
user/test/com/google/gwt/core/client/interop/MyEnumWithJsType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* | ||
* Copyright 2015 Google Inc. | ||
* | ||
* 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 com.google.gwt.core.client.interop; | ||
|
||
import com.google.gwt.core.client.js.JsType; | ||
|
||
/** | ||
* This enum is annotated as a @JsType. | ||
*/ | ||
@JsType | ||
public enum MyEnumWithJsType { | ||
TEST1(1), TEST2(2); | ||
|
||
public int idx; | ||
MyEnumWithJsType(int a) { | ||
this.idx = a; | ||
} | ||
|
||
public int idxAddOne() { | ||
return idx + 1; | ||
} | ||
|
||
public int publicMethod() { | ||
return 10; | ||
} | ||
|
||
public static void publicStaticMethod() { | ||
} | ||
|
||
private void privateMethod() { | ||
} | ||
|
||
protected void protectedMethod() { | ||
} | ||
|
||
void packageMethod() { | ||
} | ||
|
||
public int publicField = 10; | ||
|
||
public static int publicStaticField = 10; | ||
|
||
private int privateField = 10; | ||
|
||
protected int protectedField = 10; | ||
|
||
int packageField = 10; | ||
} |
Oops, something went wrong.