├── test ├── typesystem_failures.txt ├── codegen_expect │ ├── havlak │ │ ├── run.stderr │ │ ├── run.stdout │ │ ├── Expect_interface.java │ │ ├── Havlak_interface.java │ │ ├── BasicBlockEdge_interface.java │ │ ├── BenchmarkBase_interface.java │ │ ├── LSG_interface.java │ │ ├── HavlakLoopFinder_interface.java │ │ ├── CFG_interface.java │ │ ├── BasicBlock_interface.java │ │ ├── UnionFindNode_interface.java │ │ └── SimpleLoop_interface.java │ ├── matrix │ │ ├── run.stderr │ │ ├── run.stdout │ │ ├── Matrix_interface.java │ │ ├── BenchmarkBase_interface.java │ │ └── __TopLevel.java │ ├── minimal │ │ ├── run.stderr │ │ ├── run.stdout │ │ └── __TopLevel.java │ ├── tracer │ │ ├── run.stderr │ │ ├── run.stdout │ │ ├── Expect_interface.java │ │ ├── TracerBenchmark_interface.java │ │ ├── Background_interface.java │ │ ├── Solid_interface.java │ │ ├── Ray_interface.java │ │ ├── Light_interface.java │ │ ├── BaseShape_interface.java │ │ ├── Sphere_interface.java │ │ ├── Plane_interface.java │ │ ├── Chessboard_interface.java │ │ ├── Materials_interface.java │ │ ├── BenchmarkBase_interface.java │ │ ├── Scene_interface.java │ │ ├── Camera_interface.java │ │ ├── Color_interface.java │ │ ├── Vector_interface.java │ │ ├── IntersectionInfo_interface.java │ │ └── Engine_interface.java │ ├── HelloWorld │ │ ├── run.stderr │ │ ├── run.stdout │ │ └── __TopLevel.java │ ├── addition │ │ ├── run.stderr │ │ ├── run.stdout │ │ └── __TopLevel.java │ ├── barnsleyfern │ │ ├── run.stderr │ │ ├── run.stdout │ │ ├── Expect_interface.java │ │ ├── Fractal_interface.java │ │ ├── BenchmarkBase_interface.java │ │ └── __TopLevel.java │ ├── deltablue │ │ ├── run.stderr │ │ ├── run.stdout │ │ ├── DeltaBlue_interface.java │ │ ├── StayConstraint_interface.java │ │ ├── EqualityConstraint_interface.java │ │ ├── Expect_interface.java │ │ ├── EditConstraint_interface.java │ │ ├── Strength_interface.java │ │ ├── ScaleConstraint_interface.java │ │ ├── BenchmarkBase_interface.java │ │ ├── Plan_interface.java │ │ ├── UnaryConstraint_interface.java │ │ ├── Constraint_interface.java │ │ ├── BinaryConstraint_interface.java │ │ ├── Planner_interface.java │ │ ├── Variable_interface.java │ │ └── DeltaBlue.java │ ├── fluidmotion │ │ ├── run.stderr │ │ ├── run.stdout │ │ ├── Expect_interface.java │ │ ├── FluidMotion_interface.java │ │ ├── BenchmarkBase_interface.java │ │ ├── Field_interface.java │ │ └── __TopLevel.java │ ├── gameoflife │ │ ├── run.stderr │ │ ├── run.stdout │ │ ├── GameOfLife_interface.java │ │ ├── Expect_interface.java │ │ ├── BenchmarkBase_interface.java │ │ ├── Culture_interface.java │ │ ├── Cell_interface.java │ │ └── GameOfLife.java │ ├── generics │ │ ├── run.stderr │ │ ├── run.stdout │ │ ├── Qux3_interface.java │ │ ├── Bar2_interface.java │ │ ├── Foo1_interface.java │ │ ├── Bar2_interface__generic_int.java │ │ ├── Bar2_interface__int_generic.java │ │ ├── Bar2_interface__generic_double.java │ │ ├── Bar2_interface__double_generic.java │ │ ├── Bar2_interface__generic_boolean.java │ │ ├── Bar2_interface__boolean_generic.java │ │ ├── Foo1_interface__int.java │ │ ├── Foo1_interface__double.java │ │ └── Foo1_interface__boolean.java │ ├── richards │ │ ├── run.stderr │ │ ├── run.stdout │ │ ├── Richards_interface.java │ │ ├── Expect_interface.java │ │ ├── IdleTask_interface.java │ │ ├── WorkerTask_interface.java │ │ ├── Task_interface.java │ │ ├── DeviceTask_interface.java │ │ ├── BenchmarkBase_interface.java │ │ ├── HandlerTask_interface.java │ │ ├── Packet_interface.java │ │ ├── __TopLevel.java │ │ ├── TaskControlBlock_interface.java │ │ ├── Task.java │ │ └── Scheduler_interface.java │ ├── diamondsquare │ │ ├── run.stderr │ │ ├── run.stdout │ │ ├── DiamondSquare_interface.java │ │ ├── Expect_interface.java │ │ ├── BenchmarkBase_interface.java │ │ ├── __TopLevel.java │ │ └── World_interface.java │ ├── is_operator_test │ │ ├── run.stderr │ │ ├── run.stdout │ │ ├── C_interface.java │ │ ├── I_interface.java │ │ ├── IsOperatorTest_interface.java │ │ ├── AI_interface.java │ │ ├── A_interface.java │ │ ├── B_interface.java │ │ ├── Expect_interface.java │ │ ├── __TopLevel.java │ │ ├── I.java │ │ ├── C.java │ │ ├── AI.java │ │ └── B.java │ ├── specialized_list │ │ ├── run.stderr │ │ ├── run.stdout │ │ └── __TopLevel.java │ ├── interface_type_profile │ │ ├── run.stderr │ │ ├── A0_interface.java │ │ ├── A1_interface.java │ │ ├── A2_interface.java │ │ ├── A3_interface.java │ │ ├── B0_interface.java │ │ ├── B1_interface.java │ │ ├── B2_interface.java │ │ ├── B4_interface.java │ │ ├── B8_interface.java │ │ ├── B10_interface.java │ │ ├── B12_interface.java │ │ ├── B3_interface.java │ │ ├── B5_interface.java │ │ ├── B6_interface.java │ │ ├── B9_interface.java │ │ ├── C0_interface.java │ │ ├── C10_interface.java │ │ ├── C11_interface.java │ │ ├── C12_interface.java │ │ ├── C13_interface.java │ │ ├── C14_interface.java │ │ ├── C15_interface.java │ │ ├── C1_interface.java │ │ ├── C2_interface.java │ │ ├── C3_interface.java │ │ ├── C4_interface.java │ │ ├── C5_interface.java │ │ ├── C6_interface.java │ │ ├── C7_interface.java │ │ ├── C8_interface.java │ │ ├── C9_interface.java │ │ ├── B11_interface.java │ │ ├── B13_interface.java │ │ ├── B14_interface.java │ │ ├── B7_interface.java │ │ ├── run.stdout │ │ ├── B15_interface.java │ │ ├── A0.java │ │ ├── A1.java │ │ ├── A2.java │ │ ├── A3.java │ │ └── B0.java │ ├── is_interfaces_test │ │ ├── run.stderr │ │ ├── run.stdout │ │ ├── B_interface.java │ │ ├── A_interface.java │ │ ├── C_interface.java │ │ ├── Expect_interface.java │ │ ├── B.java │ │ └── A.java │ └── multifile │ │ └── file-imports │ │ ├── java_1.stdout │ │ └── compiled │ │ └── org │ │ └── dartlang │ │ └── file_import_test │ │ ├── at_level_0 │ │ └── __TopLevel.java │ │ ├── level_1 │ │ ├── at_level_1 │ │ │ └── __TopLevel.java │ │ ├── level_2 │ │ │ └── at_level_2 │ │ │ │ └── __TopLevel.java │ │ └── main │ │ │ └── __TopLevel.java │ │ └── other_1 │ │ └── at_other_1 │ │ └── __TopLevel.java ├── unit_failures.txt ├── typesystem │ └── README ├── codegen │ ├── multifile │ │ └── file-imports │ │ │ ├── test.meta │ │ │ ├── at_level_0.dart │ │ │ ├── level_1 │ │ │ ├── at_level_1.dart │ │ │ ├── level_2 │ │ │ │ └── at_level_2.dart │ │ │ └── main.dart │ │ │ └── other_1 │ │ │ └── at_other_1.dart │ ├── import │ │ ├── foo.dart │ │ └── bar.dart │ ├── minimal.dart │ ├── HelloWorld.dart │ ├── addition.dart │ ├── specialized_list.dart │ └── classes.dart ├── unit │ ├── for_in │ │ ├── scenario.dart │ │ └── Tests.java │ ├── arguments │ │ ├── scenario.dart │ │ └── Tests.java │ ├── map │ │ ├── scenario.dart │ │ └── Tests.java │ ├── basic │ │ ├── scenario.dart │ │ └── Tests.java │ ├── top_level │ │ ├── scenario.dart │ │ └── Tests.java │ ├── let │ │ ├── scenario.dart │ │ └── Tests.java │ ├── java_class │ │ ├── Tests.java │ │ └── scenario.dart │ ├── dart_class │ │ ├── Tests.java │ │ └── scenario.dart │ ├── dynamic │ │ ├── Tests.java │ │ └── scenario.dart │ ├── interface │ │ ├── Tests.java │ │ └── scenario.dart │ ├── generic_class │ │ └── Tests.java │ ├── dart_class_generic │ │ └── Tests.java │ ├── generic_assignment │ │ ├── Tests.java │ │ └── scenario.dart │ ├── generic_constructor │ │ ├── Tests.java │ │ └── scenario.dart │ ├── static │ │ ├── Tests.java │ │ └── scenario.dart │ ├── null │ │ ├── scenario.dart │ │ └── Tests.java │ ├── generic_extends │ │ └── Tests.java │ ├── generics │ │ └── Tests.java │ ├── generic_extends_type_check │ │ └── Tests.java │ ├── dart_object │ │ └── scenario.dart │ ├── constructor │ └── control_flow │ │ ├── Tests.java │ │ └── scenario.dart ├── codegen_failures.txt ├── testing.dart └── all_tests.dart ├── tool ├── input_sdk │ ├── version │ ├── lib │ │ ├── core │ │ │ ├── null.dart │ │ │ ├── type.dart │ │ │ ├── function.dart │ │ │ ├── symbol.dart │ │ │ ├── object.dart │ │ │ └── core.dart │ │ ├── async │ │ │ ├── future.dart │ │ │ ├── stream.dart │ │ │ └── async.dart │ │ └── internal │ │ │ └── internal.dart │ ├── patch │ │ └── internal_patch.dart │ └── internal │ │ ├── dart_map.dart │ │ └── java_annotations.dart ├── sdk_impl │ └── java │ │ └── dart │ │ └── _runtime │ │ ├── helpers │ │ ├── ConstructorHelper.java │ │ ├── LetExpressionHelper.java │ │ ├── StopwatchHelper.java │ │ └── ObjectHelper.java │ │ ├── base │ │ └── DartObject_interface.java │ │ └── types │ │ └── simple │ │ ├── TypeExpr.java │ │ └── package-info.java ├── patch_sdk.sh ├── presubmit.sh ├── analyze.sh ├── format.sh └── build_sdk.sh ├── third_party ├── junit-4.12 │ ├── junit-4.12.jar.md5 │ ├── junit-4.12.jar.sha1 │ ├── junit-4.12.jar │ └── README.google ├── daftspaniel │ ├── README.google │ └── LICENSE ├── ton80 │ └── README.google └── hamcrest-1.3 │ ├── hamcrest-core-1.3.jar │ ├── hamcrest-core-1.3-src.jar │ ├── hamcrest-library-1.3.jar │ ├── hamcrest-library-1.3-src.jar │ ├── README.google │ └── LICENSE ├── benchmark ├── README.md ├── java-invokes │ ├── java-invokes.iml │ └── build.sh └── analysis │ └── plot-cmp.gnuplot ├── codereview.settings ├── .analysis_options ├── .gitignore ├── .travis.yml ├── CONTRIBUTING.md ├── README.md └── pubspec.yaml /test/typesystem_failures.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tool/input_sdk/version: -------------------------------------------------------------------------------- 1 | 1.17.1 2 | -------------------------------------------------------------------------------- /test/codegen_expect/havlak/run.stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/codegen_expect/matrix/run.stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/codegen_expect/minimal/run.stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/codegen_expect/minimal/run.stdout: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/codegen_expect/tracer/run.stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/codegen_expect/HelloWorld/run.stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/codegen_expect/addition/run.stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/codegen_expect/barnsleyfern/run.stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/codegen_expect/deltablue/run.stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/codegen_expect/fluidmotion/run.stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/codegen_expect/gameoflife/run.stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/codegen_expect/generics/run.stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/codegen_expect/richards/run.stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/codegen_expect/diamondsquare/run.stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/codegen_expect/is_operator_test/run.stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/codegen_expect/is_operator_test/run.stdout: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/codegen_expect/specialized_list/run.stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/codegen_expect/addition/run.stdout: -------------------------------------------------------------------------------- 1 | 4 2 | 8 3 | -------------------------------------------------------------------------------- /test/codegen_expect/interface_type_profile/run.stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/codegen_expect/is_interfaces_test/run.stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/codegen_expect/is_interfaces_test/run.stdout: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/codegen_expect/HelloWorld/run.stdout: -------------------------------------------------------------------------------- 1 | Hello, World! 2 | -------------------------------------------------------------------------------- /third_party/junit-4.12/junit-4.12.jar.md5: -------------------------------------------------------------------------------- 1 | 5b38c40c97fbd0adee29f91e60405584 -------------------------------------------------------------------------------- /test/codegen_expect/havlak/run.stdout: -------------------------------------------------------------------------------- 1 | Havlak(RunTime): 2.449204406364749 us. 2 | -------------------------------------------------------------------------------- /third_party/junit-4.12/junit-4.12.jar.sha1: -------------------------------------------------------------------------------- 1 | 2973d150c0dc1fefe998f834810d68f278ea58ec -------------------------------------------------------------------------------- /test/codegen_expect/fluidmotion/run.stdout: -------------------------------------------------------------------------------- 1 | FluidMotion(RunTime): 48.38095238095238 us. 2 | -------------------------------------------------------------------------------- /test/codegen_expect/specialized_list/run.stdout: -------------------------------------------------------------------------------- 1 | Expect output 5, 7, 9 2 | 5 3 | 7 4 | 9 5 | -------------------------------------------------------------------------------- /test/unit_failures.txt: -------------------------------------------------------------------------------- 1 | java_class // Broken until List and Map handle type parameters correctly. -------------------------------------------------------------------------------- /test/codegen_expect/tracer/run.stdout: -------------------------------------------------------------------------------- 1 | Running benchmark... 2 | Tracer(RunTime): 568.0 us. 3 | Done. 4 | -------------------------------------------------------------------------------- /third_party/daftspaniel/README.google: -------------------------------------------------------------------------------- 1 | URL: https://github.com/daftspaniel 2 | License File: LICENSE 3 | -------------------------------------------------------------------------------- /test/codegen_expect/richards/run.stdout: -------------------------------------------------------------------------------- 1 | Running benchmark... 2 | Richards(RunTime): 104.9 us. 3 | Done. 4 | -------------------------------------------------------------------------------- /test/typesystem/README: -------------------------------------------------------------------------------- 1 | JUnit tests that test pure Java code, such as the type system implementation. 2 | -------------------------------------------------------------------------------- /test/codegen_expect/gameoflife/run.stdout: -------------------------------------------------------------------------------- 1 | Running benchmark... 2 | GameOfLife(RunTime): 4217.0 us. 3 | Done. 4 | -------------------------------------------------------------------------------- /test/codegen_expect/matrix/run.stdout: -------------------------------------------------------------------------------- 1 | Running benchmark... 2 | Matrix(RunTime): 237.72727272727275 us. 3 | Done. 4 | -------------------------------------------------------------------------------- /test/codegen_expect/multifile/file-imports/java_1.stdout: -------------------------------------------------------------------------------- 1 | At level 1 2 | At level 2 3 | At level 0 4 | At other 1 5 | -------------------------------------------------------------------------------- /test/codegen_expect/deltablue/run.stdout: -------------------------------------------------------------------------------- 1 | Running benchmark... 2 | DeltaBlue(RunTime): 242.44444444444443 us. 3 | Done. 4 | -------------------------------------------------------------------------------- /third_party/ton80/README.google: -------------------------------------------------------------------------------- 1 | URL: https://github.com/dart-lang/ton80 2 | License: Various 3 | License File: LICENSE 4 | -------------------------------------------------------------------------------- /test/codegen_expect/barnsleyfern/run.stdout: -------------------------------------------------------------------------------- 1 | Running benchmark... 2 | Barnsley Fern Fractal(RunTime): 1548.5 us. 3 | Done. 4 | -------------------------------------------------------------------------------- /third_party/junit-4.12/junit-4.12.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/dart2java/HEAD/third_party/junit-4.12/junit-4.12.jar -------------------------------------------------------------------------------- /test/codegen_expect/diamondsquare/run.stdout: -------------------------------------------------------------------------------- 1 | Running benchmark... 2 | DiamondSquare(RunTime): 172.16666666666666 us. 3 | Done. 4 | -------------------------------------------------------------------------------- /third_party/hamcrest-1.3/hamcrest-core-1.3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/dart2java/HEAD/third_party/hamcrest-1.3/hamcrest-core-1.3.jar -------------------------------------------------------------------------------- /third_party/hamcrest-1.3/hamcrest-core-1.3-src.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/dart2java/HEAD/third_party/hamcrest-1.3/hamcrest-core-1.3-src.jar -------------------------------------------------------------------------------- /third_party/hamcrest-1.3/hamcrest-library-1.3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/dart2java/HEAD/third_party/hamcrest-1.3/hamcrest-library-1.3.jar -------------------------------------------------------------------------------- /third_party/hamcrest-1.3/hamcrest-library-1.3-src.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/dart2java/HEAD/third_party/hamcrest-1.3/hamcrest-library-1.3-src.jar -------------------------------------------------------------------------------- /benchmark/README.md: -------------------------------------------------------------------------------- 1 | # Performance Benchmark of different Java invoke mechanisms 2 | 3 | To run: 4 | 5 | ./java-invokes/build.sh 6 | ./analysis/run.sh 7 | -------------------------------------------------------------------------------- /test/codegen_expect/generics/run.stdout: -------------------------------------------------------------------------------- 1 | Expecting 12, 11, 13, 14.01, 2.3, 50, 51, 50, 51 2 | 12 3 | 11 4 | 13 5 | 14.01 6 | 2.3 7 | 50 8 | 51 9 | 50 10 | 51 11 | -------------------------------------------------------------------------------- /test/codegen_expect/is_operator_test/C_interface.java: -------------------------------------------------------------------------------- 1 | package is_operator_test; 2 | 3 | public interface C_interface extends is_operator_test.A_interface 4 | { 5 | 6 | 7 | } 8 | -------------------------------------------------------------------------------- /codereview.settings: -------------------------------------------------------------------------------- 1 | CODE_REVIEW_SERVER: http://codereview.chromium.org 2 | VIEW_VC: https://github.com/google/dart2java/commit/ 3 | CC_LIST: dart-sea-interns-2016+reviews@google.com 4 | -------------------------------------------------------------------------------- /test/codegen_expect/is_interfaces_test/B_interface.java: -------------------------------------------------------------------------------- 1 | package is_interfaces_test; 2 | 3 | public interface B_interface extends is_interfaces_test.A_interface 4 | { 5 | 6 | 7 | } 8 | -------------------------------------------------------------------------------- /test/codegen_expect/matrix/Matrix_interface.java: -------------------------------------------------------------------------------- 1 | package matrix; 2 | 3 | public interface Matrix_interface extends matrix.BenchmarkBase_interface 4 | { 5 | void run(); 6 | 7 | } 8 | -------------------------------------------------------------------------------- /test/codegen_expect/is_operator_test/I_interface.java: -------------------------------------------------------------------------------- 1 | package is_operator_test; 2 | 3 | public interface I_interface extends dart._runtime.base.DartObject_interface 4 | { 5 | 6 | 7 | } 8 | -------------------------------------------------------------------------------- /test/codegen_expect/is_interfaces_test/A_interface.java: -------------------------------------------------------------------------------- 1 | package is_interfaces_test; 2 | 3 | public interface A_interface extends dart._runtime.base.DartObject_interface 4 | { 5 | 6 | 7 | } 8 | -------------------------------------------------------------------------------- /test/codegen_expect/richards/Richards_interface.java: -------------------------------------------------------------------------------- 1 | package richards; 2 | 3 | public interface Richards_interface extends richards.BenchmarkBase_interface 4 | { 5 | void run(); 6 | 7 | } 8 | -------------------------------------------------------------------------------- /test/codegen_expect/deltablue/DeltaBlue_interface.java: -------------------------------------------------------------------------------- 1 | package deltablue; 2 | 3 | public interface DeltaBlue_interface extends deltablue.BenchmarkBase_interface 4 | { 5 | void run(); 6 | 7 | } 8 | -------------------------------------------------------------------------------- /test/codegen_expect/gameoflife/GameOfLife_interface.java: -------------------------------------------------------------------------------- 1 | package gameoflife; 2 | 3 | public interface GameOfLife_interface extends gameoflife.BenchmarkBase_interface 4 | { 5 | void run(); 6 | 7 | } 8 | -------------------------------------------------------------------------------- /test/codegen_expect/interface_type_profile/A0_interface.java: -------------------------------------------------------------------------------- 1 | package interface_type_profile; 2 | 3 | public interface A0_interface extends dart._runtime.base.DartObject_interface 4 | { 5 | 6 | 7 | } 8 | -------------------------------------------------------------------------------- /test/codegen_expect/interface_type_profile/A1_interface.java: -------------------------------------------------------------------------------- 1 | package interface_type_profile; 2 | 3 | public interface A1_interface extends dart._runtime.base.DartObject_interface 4 | { 5 | 6 | 7 | } 8 | -------------------------------------------------------------------------------- /test/codegen_expect/interface_type_profile/A2_interface.java: -------------------------------------------------------------------------------- 1 | package interface_type_profile; 2 | 3 | public interface A2_interface extends dart._runtime.base.DartObject_interface 4 | { 5 | 6 | 7 | } 8 | -------------------------------------------------------------------------------- /test/codegen_expect/interface_type_profile/A3_interface.java: -------------------------------------------------------------------------------- 1 | package interface_type_profile; 2 | 3 | public interface A3_interface extends dart._runtime.base.DartObject_interface 4 | { 5 | 6 | 7 | } 8 | -------------------------------------------------------------------------------- /test/codegen_expect/interface_type_profile/B0_interface.java: -------------------------------------------------------------------------------- 1 | package interface_type_profile; 2 | 3 | public interface B0_interface extends dart._runtime.base.DartObject_interface 4 | { 5 | 6 | 7 | } 8 | -------------------------------------------------------------------------------- /test/codegen_expect/deltablue/StayConstraint_interface.java: -------------------------------------------------------------------------------- 1 | package deltablue; 2 | 3 | public interface StayConstraint_interface extends deltablue.UnaryConstraint_interface 4 | { 5 | void execute(); 6 | 7 | } 8 | -------------------------------------------------------------------------------- /test/codegen_expect/generics/Qux3_interface.java: -------------------------------------------------------------------------------- 1 | package generics; 2 | 3 | public interface Qux3_interface extends dart._runtime.base.DartObject_interface 4 | { 5 | C qux_Qux3(C c, D d, E e); 6 | 7 | } 8 | -------------------------------------------------------------------------------- /test/codegen_expect/is_operator_test/IsOperatorTest_interface.java: -------------------------------------------------------------------------------- 1 | package is_operator_test; 2 | 3 | public interface IsOperatorTest_interface extends dart._runtime.base.DartObject_interface 4 | { 5 | 6 | 7 | } 8 | -------------------------------------------------------------------------------- /test/codegen_expect/diamondsquare/DiamondSquare_interface.java: -------------------------------------------------------------------------------- 1 | package diamondsquare; 2 | 3 | public interface DiamondSquare_interface extends diamondsquare.BenchmarkBase_interface 4 | { 5 | void run(); 6 | 7 | } 8 | -------------------------------------------------------------------------------- /test/codegen_expect/havlak/Expect_interface.java: -------------------------------------------------------------------------------- 1 | package havlak; 2 | 3 | public interface Expect_interface extends dart._runtime.base.DartObject_interface 4 | { 5 | void fail(java.lang.String message); 6 | 7 | } 8 | -------------------------------------------------------------------------------- /test/codegen_expect/is_operator_test/AI_interface.java: -------------------------------------------------------------------------------- 1 | package is_operator_test; 2 | 3 | public interface AI_interface extends dart._runtime.base.DartObject_interface, is_operator_test.I_interface 4 | { 5 | 6 | 7 | } 8 | -------------------------------------------------------------------------------- /test/codegen_expect/is_operator_test/A_interface.java: -------------------------------------------------------------------------------- 1 | package is_operator_test; 2 | 3 | public interface A_interface extends dart._runtime.base.DartObject_interface, is_operator_test.AI_interface 4 | { 5 | 6 | 7 | } 8 | -------------------------------------------------------------------------------- /test/codegen_expect/is_operator_test/B_interface.java: -------------------------------------------------------------------------------- 1 | package is_operator_test; 2 | 3 | public interface B_interface extends dart._runtime.base.DartObject_interface, is_operator_test.I_interface 4 | { 5 | 6 | 7 | } 8 | -------------------------------------------------------------------------------- /test/codegen_expect/richards/Expect_interface.java: -------------------------------------------------------------------------------- 1 | package richards; 2 | 3 | public interface Expect_interface extends dart._runtime.base.DartObject_interface 4 | { 5 | void fail(java.lang.String message); 6 | 7 | } 8 | -------------------------------------------------------------------------------- /test/codegen_expect/tracer/Expect_interface.java: -------------------------------------------------------------------------------- 1 | package tracer; 2 | 3 | public interface Expect_interface extends dart._runtime.base.DartObject_interface 4 | { 5 | void fail(java.lang.String message); 6 | 7 | } 8 | -------------------------------------------------------------------------------- /test/codegen_expect/deltablue/EqualityConstraint_interface.java: -------------------------------------------------------------------------------- 1 | package deltablue; 2 | 3 | public interface EqualityConstraint_interface extends deltablue.BinaryConstraint_interface 4 | { 5 | void execute(); 6 | 7 | } 8 | -------------------------------------------------------------------------------- /test/codegen_expect/deltablue/Expect_interface.java: -------------------------------------------------------------------------------- 1 | package deltablue; 2 | 3 | public interface Expect_interface extends dart._runtime.base.DartObject_interface 4 | { 5 | void fail(java.lang.String message); 6 | 7 | } 8 | -------------------------------------------------------------------------------- /test/codegen_expect/gameoflife/Expect_interface.java: -------------------------------------------------------------------------------- 1 | package gameoflife; 2 | 3 | public interface Expect_interface extends dart._runtime.base.DartObject_interface 4 | { 5 | void fail(java.lang.String message); 6 | 7 | } 8 | -------------------------------------------------------------------------------- /test/codegen_expect/is_interfaces_test/C_interface.java: -------------------------------------------------------------------------------- 1 | package is_interfaces_test; 2 | 3 | public interface C_interface extends dart._runtime.base.DartObject_interface, is_interfaces_test.B_interface 4 | { 5 | 6 | 7 | } 8 | -------------------------------------------------------------------------------- /test/codegen_expect/barnsleyfern/Expect_interface.java: -------------------------------------------------------------------------------- 1 | package barnsleyfern; 2 | 3 | public interface Expect_interface extends dart._runtime.base.DartObject_interface 4 | { 5 | void fail(java.lang.String message); 6 | 7 | } 8 | -------------------------------------------------------------------------------- /test/codegen_expect/diamondsquare/Expect_interface.java: -------------------------------------------------------------------------------- 1 | package diamondsquare; 2 | 3 | public interface Expect_interface extends dart._runtime.base.DartObject_interface 4 | { 5 | void fail(java.lang.String message); 6 | 7 | } 8 | -------------------------------------------------------------------------------- /test/codegen_expect/fluidmotion/Expect_interface.java: -------------------------------------------------------------------------------- 1 | package fluidmotion; 2 | 3 | public interface Expect_interface extends dart._runtime.base.DartObject_interface 4 | { 5 | void fail(java.lang.String message); 6 | 7 | } 8 | -------------------------------------------------------------------------------- /test/codegen_expect/tracer/TracerBenchmark_interface.java: -------------------------------------------------------------------------------- 1 | package tracer; 2 | 3 | public interface TracerBenchmark_interface extends tracer.BenchmarkBase_interface 4 | { 5 | void warmup(); 6 | void exercise(); 7 | 8 | } 9 | -------------------------------------------------------------------------------- /test/codegen_expect/barnsleyfern/Fractal_interface.java: -------------------------------------------------------------------------------- 1 | package barnsleyfern; 2 | 3 | public interface Fractal_interface extends barnsleyfern.BenchmarkBase_interface 4 | { 5 | void run(); 6 | int drawBarnsleyFern(); 7 | 8 | } 9 | -------------------------------------------------------------------------------- /test/codegen_expect/fluidmotion/FluidMotion_interface.java: -------------------------------------------------------------------------------- 1 | package fluidmotion; 2 | 3 | public interface FluidMotion_interface extends fluidmotion.BenchmarkBase_interface 4 | { 5 | void warmup(); 6 | void exercise(); 7 | 8 | } 9 | -------------------------------------------------------------------------------- /test/codegen_expect/deltablue/EditConstraint_interface.java: -------------------------------------------------------------------------------- 1 | package deltablue; 2 | 3 | public interface EditConstraint_interface extends deltablue.UnaryConstraint_interface 4 | { 5 | boolean isInput(); 6 | void execute(); 7 | 8 | } 9 | -------------------------------------------------------------------------------- /test/codegen_expect/interface_type_profile/B1_interface.java: -------------------------------------------------------------------------------- 1 | package interface_type_profile; 2 | 3 | public interface B1_interface extends dart._runtime.base.DartObject_interface, interface_type_profile.A0_interface 4 | { 5 | 6 | 7 | } 8 | -------------------------------------------------------------------------------- /test/codegen_expect/interface_type_profile/B2_interface.java: -------------------------------------------------------------------------------- 1 | package interface_type_profile; 2 | 3 | public interface B2_interface extends dart._runtime.base.DartObject_interface, interface_type_profile.A1_interface 4 | { 5 | 6 | 7 | } 8 | -------------------------------------------------------------------------------- /test/codegen_expect/interface_type_profile/B4_interface.java: -------------------------------------------------------------------------------- 1 | package interface_type_profile; 2 | 3 | public interface B4_interface extends dart._runtime.base.DartObject_interface, interface_type_profile.A2_interface 4 | { 5 | 6 | 7 | } 8 | -------------------------------------------------------------------------------- /test/codegen_expect/interface_type_profile/B8_interface.java: -------------------------------------------------------------------------------- 1 | package interface_type_profile; 2 | 3 | public interface B8_interface extends dart._runtime.base.DartObject_interface, interface_type_profile.A3_interface 4 | { 5 | 6 | 7 | } 8 | -------------------------------------------------------------------------------- /test/codegen_expect/is_operator_test/Expect_interface.java: -------------------------------------------------------------------------------- 1 | package is_operator_test; 2 | 3 | public interface Expect_interface extends dart._runtime.base.DartObject_interface 4 | { 5 | int getX(); 6 | int setX(int value); 7 | 8 | } 9 | -------------------------------------------------------------------------------- /test/codegen_expect/is_interfaces_test/Expect_interface.java: -------------------------------------------------------------------------------- 1 | package is_interfaces_test; 2 | 3 | public interface Expect_interface extends dart._runtime.base.DartObject_interface 4 | { 5 | int getX(); 6 | int setX(int value); 7 | 8 | } 9 | -------------------------------------------------------------------------------- /test/codegen_expect/tracer/Background_interface.java: -------------------------------------------------------------------------------- 1 | package tracer; 2 | 3 | public interface Background_interface extends dart._runtime.base.DartObject_interface 4 | { 5 | tracer.Color_interface getColor(); 6 | double getAmbience(); 7 | 8 | } 9 | -------------------------------------------------------------------------------- /third_party/junit-4.12/README.google: -------------------------------------------------------------------------------- 1 | URL: http://search.maven.org/remotecontent?filepath=junit/junit/4.12/junit-4.12.jar 2 | License: Common Public License Version 1.0 3 | License File: LICENSE 4 | Version: 4.12 5 | 6 | Local Modifications: 7 | None -------------------------------------------------------------------------------- /test/codegen_expect/havlak/Havlak_interface.java: -------------------------------------------------------------------------------- 1 | package havlak; 2 | 3 | public interface Havlak_interface extends havlak.BenchmarkBase_interface 4 | { 5 | void exercise(); 6 | void warmup(); 7 | havlak.CFG_interface getCfg(); 8 | 9 | } 10 | -------------------------------------------------------------------------------- /.analysis_options: -------------------------------------------------------------------------------- 1 | analyzer: 2 | strong-mode: true 3 | exclude: 4 | - doc/api/** 5 | - gen/** 6 | - node_modules/** 7 | - tool/input_sdk/** 8 | - test/codegen/** 9 | - test/samples/** 10 | - test/transformer/hello_app/** 11 | -------------------------------------------------------------------------------- /third_party/hamcrest-1.3/README.google: -------------------------------------------------------------------------------- 1 | URL: http://hamcrest.googlecode.com/files/hamcrest-1.3.tgz 2 | License: BSD 3 | License File: LICENSE 4 | Version: 1.3 5 | 6 | Local Modifications: 7 | None 8 | 9 | The source code is bundled in the accompanying .jar files. 10 | -------------------------------------------------------------------------------- /test/codegen/multifile/file-imports/test.meta: -------------------------------------------------------------------------------- 1 | dart2java --package-prefix=org.dartlang.file_import_test at_level_0.dart level_1/at_level_1.dart level_1/main.dart level_1/level_2/at_level_2.dart other_1/at_other_1.dart 2 | java org.dartlang.file_import_test.level_1.main.__TopLevel 3 | -------------------------------------------------------------------------------- /test/codegen_expect/interface_type_profile/B10_interface.java: -------------------------------------------------------------------------------- 1 | package interface_type_profile; 2 | 3 | public interface B10_interface extends dart._runtime.base.DartObject_interface, interface_type_profile.A3_interface, interface_type_profile.A1_interface 4 | { 5 | 6 | 7 | } 8 | -------------------------------------------------------------------------------- /test/codegen_expect/interface_type_profile/B12_interface.java: -------------------------------------------------------------------------------- 1 | package interface_type_profile; 2 | 3 | public interface B12_interface extends dart._runtime.base.DartObject_interface, interface_type_profile.A3_interface, interface_type_profile.A2_interface 4 | { 5 | 6 | 7 | } 8 | -------------------------------------------------------------------------------- /test/codegen_expect/interface_type_profile/B3_interface.java: -------------------------------------------------------------------------------- 1 | package interface_type_profile; 2 | 3 | public interface B3_interface extends dart._runtime.base.DartObject_interface, interface_type_profile.A1_interface, interface_type_profile.A0_interface 4 | { 5 | 6 | 7 | } 8 | -------------------------------------------------------------------------------- /test/codegen_expect/interface_type_profile/B5_interface.java: -------------------------------------------------------------------------------- 1 | package interface_type_profile; 2 | 3 | public interface B5_interface extends dart._runtime.base.DartObject_interface, interface_type_profile.A2_interface, interface_type_profile.A0_interface 4 | { 5 | 6 | 7 | } 8 | -------------------------------------------------------------------------------- /test/codegen_expect/interface_type_profile/B6_interface.java: -------------------------------------------------------------------------------- 1 | package interface_type_profile; 2 | 3 | public interface B6_interface extends dart._runtime.base.DartObject_interface, interface_type_profile.A2_interface, interface_type_profile.A1_interface 4 | { 5 | 6 | 7 | } 8 | -------------------------------------------------------------------------------- /test/codegen_expect/interface_type_profile/B9_interface.java: -------------------------------------------------------------------------------- 1 | package interface_type_profile; 2 | 3 | public interface B9_interface extends dart._runtime.base.DartObject_interface, interface_type_profile.A3_interface, interface_type_profile.A0_interface 4 | { 5 | 6 | 7 | } 8 | -------------------------------------------------------------------------------- /test/codegen_expect/interface_type_profile/C0_interface.java: -------------------------------------------------------------------------------- 1 | package interface_type_profile; 2 | 3 | public interface C0_interface extends dart._runtime.base.DartObject_interface, interface_type_profile.B0_interface, interface_type_profile.B1_interface 4 | { 5 | 6 | 7 | } 8 | -------------------------------------------------------------------------------- /test/codegen_expect/interface_type_profile/C10_interface.java: -------------------------------------------------------------------------------- 1 | package interface_type_profile; 2 | 3 | public interface C10_interface extends dart._runtime.base.DartObject_interface, interface_type_profile.B10_interface, interface_type_profile.B11_interface 4 | { 5 | 6 | 7 | } 8 | -------------------------------------------------------------------------------- /test/codegen_expect/interface_type_profile/C11_interface.java: -------------------------------------------------------------------------------- 1 | package interface_type_profile; 2 | 3 | public interface C11_interface extends dart._runtime.base.DartObject_interface, interface_type_profile.B11_interface, interface_type_profile.B12_interface 4 | { 5 | 6 | 7 | } 8 | -------------------------------------------------------------------------------- /test/codegen_expect/interface_type_profile/C12_interface.java: -------------------------------------------------------------------------------- 1 | package interface_type_profile; 2 | 3 | public interface C12_interface extends dart._runtime.base.DartObject_interface, interface_type_profile.B12_interface, interface_type_profile.B13_interface 4 | { 5 | 6 | 7 | } 8 | -------------------------------------------------------------------------------- /test/codegen_expect/interface_type_profile/C13_interface.java: -------------------------------------------------------------------------------- 1 | package interface_type_profile; 2 | 3 | public interface C13_interface extends dart._runtime.base.DartObject_interface, interface_type_profile.B13_interface, interface_type_profile.B14_interface 4 | { 5 | 6 | 7 | } 8 | -------------------------------------------------------------------------------- /test/codegen_expect/interface_type_profile/C14_interface.java: -------------------------------------------------------------------------------- 1 | package interface_type_profile; 2 | 3 | public interface C14_interface extends dart._runtime.base.DartObject_interface, interface_type_profile.B14_interface, interface_type_profile.B15_interface 4 | { 5 | 6 | 7 | } 8 | -------------------------------------------------------------------------------- /test/codegen_expect/interface_type_profile/C15_interface.java: -------------------------------------------------------------------------------- 1 | package interface_type_profile; 2 | 3 | public interface C15_interface extends dart._runtime.base.DartObject_interface, interface_type_profile.B15_interface, interface_type_profile.B0_interface 4 | { 5 | 6 | 7 | } 8 | -------------------------------------------------------------------------------- /test/codegen_expect/interface_type_profile/C1_interface.java: -------------------------------------------------------------------------------- 1 | package interface_type_profile; 2 | 3 | public interface C1_interface extends dart._runtime.base.DartObject_interface, interface_type_profile.B1_interface, interface_type_profile.B2_interface 4 | { 5 | 6 | 7 | } 8 | -------------------------------------------------------------------------------- /test/codegen_expect/interface_type_profile/C2_interface.java: -------------------------------------------------------------------------------- 1 | package interface_type_profile; 2 | 3 | public interface C2_interface extends dart._runtime.base.DartObject_interface, interface_type_profile.B2_interface, interface_type_profile.B3_interface 4 | { 5 | 6 | 7 | } 8 | -------------------------------------------------------------------------------- /test/codegen_expect/interface_type_profile/C3_interface.java: -------------------------------------------------------------------------------- 1 | package interface_type_profile; 2 | 3 | public interface C3_interface extends dart._runtime.base.DartObject_interface, interface_type_profile.B3_interface, interface_type_profile.B4_interface 4 | { 5 | 6 | 7 | } 8 | -------------------------------------------------------------------------------- /test/codegen_expect/interface_type_profile/C4_interface.java: -------------------------------------------------------------------------------- 1 | package interface_type_profile; 2 | 3 | public interface C4_interface extends dart._runtime.base.DartObject_interface, interface_type_profile.B4_interface, interface_type_profile.B5_interface 4 | { 5 | 6 | 7 | } 8 | -------------------------------------------------------------------------------- /test/codegen_expect/interface_type_profile/C5_interface.java: -------------------------------------------------------------------------------- 1 | package interface_type_profile; 2 | 3 | public interface C5_interface extends dart._runtime.base.DartObject_interface, interface_type_profile.B5_interface, interface_type_profile.B6_interface 4 | { 5 | 6 | 7 | } 8 | -------------------------------------------------------------------------------- /test/codegen_expect/interface_type_profile/C6_interface.java: -------------------------------------------------------------------------------- 1 | package interface_type_profile; 2 | 3 | public interface C6_interface extends dart._runtime.base.DartObject_interface, interface_type_profile.B6_interface, interface_type_profile.B7_interface 4 | { 5 | 6 | 7 | } 8 | -------------------------------------------------------------------------------- /test/codegen_expect/interface_type_profile/C7_interface.java: -------------------------------------------------------------------------------- 1 | package interface_type_profile; 2 | 3 | public interface C7_interface extends dart._runtime.base.DartObject_interface, interface_type_profile.B7_interface, interface_type_profile.B8_interface 4 | { 5 | 6 | 7 | } 8 | -------------------------------------------------------------------------------- /test/codegen_expect/interface_type_profile/C8_interface.java: -------------------------------------------------------------------------------- 1 | package interface_type_profile; 2 | 3 | public interface C8_interface extends dart._runtime.base.DartObject_interface, interface_type_profile.B8_interface, interface_type_profile.B9_interface 4 | { 5 | 6 | 7 | } 8 | -------------------------------------------------------------------------------- /test/codegen_expect/interface_type_profile/C9_interface.java: -------------------------------------------------------------------------------- 1 | package interface_type_profile; 2 | 3 | public interface C9_interface extends dart._runtime.base.DartObject_interface, interface_type_profile.B9_interface, interface_type_profile.B10_interface 4 | { 5 | 6 | 7 | } 8 | -------------------------------------------------------------------------------- /test/codegen_expect/tracer/Solid_interface.java: -------------------------------------------------------------------------------- 1 | package tracer; 2 | 3 | public interface Solid_interface extends tracer.Materials_interface 4 | { 5 | tracer.Color_interface getColor_(java.lang.Number u, java.lang.Number v); 6 | tracer.Color_interface getColor(); 7 | 8 | } 9 | -------------------------------------------------------------------------------- /test/codegen_expect/tracer/Ray_interface.java: -------------------------------------------------------------------------------- 1 | package tracer; 2 | 3 | public interface Ray_interface extends dart._runtime.base.DartObject_interface 4 | { 5 | java.lang.String toString(); 6 | java.lang.Object getPosition(); 7 | java.lang.Object getDirection(); 8 | 9 | } 10 | -------------------------------------------------------------------------------- /test/codegen_expect/tracer/Light_interface.java: -------------------------------------------------------------------------------- 1 | package tracer; 2 | 3 | public interface Light_interface extends dart._runtime.base.DartObject_interface 4 | { 5 | java.lang.Object getPosition(); 6 | java.lang.Object getColor(); 7 | java.lang.Object getIntensity(); 8 | 9 | } 10 | -------------------------------------------------------------------------------- /test/codegen_expect/deltablue/Strength_interface.java: -------------------------------------------------------------------------------- 1 | package deltablue; 2 | 3 | public interface Strength_interface extends dart._runtime.base.DartObject_interface 4 | { 5 | deltablue.Strength_interface nextWeaker(); 6 | int getValue(); 7 | java.lang.String getName(); 8 | 9 | } 10 | -------------------------------------------------------------------------------- /test/codegen_expect/tracer/BaseShape_interface.java: -------------------------------------------------------------------------------- 1 | package tracer; 2 | 3 | public interface BaseShape_interface extends dart._runtime.base.DartObject_interface 4 | { 5 | java.lang.String toString(); 6 | java.lang.Object getPosition(); 7 | java.lang.Object getMaterial(); 8 | 9 | } 10 | -------------------------------------------------------------------------------- /test/codegen_expect/tracer/Sphere_interface.java: -------------------------------------------------------------------------------- 1 | package tracer; 2 | 3 | public interface Sphere_interface extends tracer.BaseShape_interface 4 | { 5 | tracer.IntersectionInfo_interface intersect(tracer.Ray_interface ray); 6 | java.lang.String toString(); 7 | double getRadius(); 8 | 9 | } 10 | -------------------------------------------------------------------------------- /test/codegen_expect/interface_type_profile/B11_interface.java: -------------------------------------------------------------------------------- 1 | package interface_type_profile; 2 | 3 | public interface B11_interface extends dart._runtime.base.DartObject_interface, interface_type_profile.A3_interface, interface_type_profile.A1_interface, interface_type_profile.A0_interface 4 | { 5 | 6 | 7 | } 8 | -------------------------------------------------------------------------------- /test/codegen_expect/interface_type_profile/B13_interface.java: -------------------------------------------------------------------------------- 1 | package interface_type_profile; 2 | 3 | public interface B13_interface extends dart._runtime.base.DartObject_interface, interface_type_profile.A3_interface, interface_type_profile.A2_interface, interface_type_profile.A0_interface 4 | { 5 | 6 | 7 | } 8 | -------------------------------------------------------------------------------- /test/codegen_expect/interface_type_profile/B14_interface.java: -------------------------------------------------------------------------------- 1 | package interface_type_profile; 2 | 3 | public interface B14_interface extends dart._runtime.base.DartObject_interface, interface_type_profile.A3_interface, interface_type_profile.A2_interface, interface_type_profile.A1_interface 4 | { 5 | 6 | 7 | } 8 | -------------------------------------------------------------------------------- /test/codegen_expect/interface_type_profile/B7_interface.java: -------------------------------------------------------------------------------- 1 | package interface_type_profile; 2 | 3 | public interface B7_interface extends dart._runtime.base.DartObject_interface, interface_type_profile.A2_interface, interface_type_profile.A1_interface, interface_type_profile.A0_interface 4 | { 5 | 6 | 7 | } 8 | -------------------------------------------------------------------------------- /test/codegen_expect/tracer/Plane_interface.java: -------------------------------------------------------------------------------- 1 | package tracer; 2 | 3 | public interface Plane_interface extends tracer.BaseShape_interface 4 | { 5 | tracer.IntersectionInfo_interface intersect(tracer.Ray_interface ray); 6 | java.lang.String toString(); 7 | java.lang.Object getD(); 8 | 9 | } 10 | -------------------------------------------------------------------------------- /test/codegen_expect/generics/Bar2_interface.java: -------------------------------------------------------------------------------- 1 | package generics; 2 | 3 | public interface Bar2_interface extends dart._runtime.base.DartObject_interface 4 | { 5 | A bar_Bar2(A a, B b); 6 | A getVarA_Bar2(); 7 | B getVarB_Bar2(); 8 | A setVarA_Bar2(A value); 9 | B setVarB_Bar2(B value); 10 | 11 | } 12 | -------------------------------------------------------------------------------- /test/codegen_expect/interface_type_profile/run.stdout: -------------------------------------------------------------------------------- 1 | Percent of objects that are an A0: 43.801899999999996 (expected 0.4375) 2 | Percent of objects that are an A1: 37.479800000000004 (expected 0.375) 3 | Percent of objects that are an A2: 34.3617 (expected 0.34375) 4 | Percent of objects that are an A3: 32.805800000000005 (expected 0.328125) 5 | -------------------------------------------------------------------------------- /test/codegen_expect/minimal/__TopLevel.java: -------------------------------------------------------------------------------- 1 | package minimal; 2 | 3 | public class __TopLevel 4 | { 5 | 6 | 7 | 8 | 9 | public static void main(String[] args) 10 | { 11 | final dart._runtime.types.simple.TypeEnvironment dart2java$localTypeEnv = dart._runtime.types.simple.TypeEnvironment.ROOT; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /test/codegen_expect/interface_type_profile/B15_interface.java: -------------------------------------------------------------------------------- 1 | package interface_type_profile; 2 | 3 | public interface B15_interface extends dart._runtime.base.DartObject_interface, interface_type_profile.A3_interface, interface_type_profile.A2_interface, interface_type_profile.A1_interface, interface_type_profile.A0_interface 4 | { 5 | 6 | 7 | } 8 | -------------------------------------------------------------------------------- /test/codegen_expect/tracer/Chessboard_interface.java: -------------------------------------------------------------------------------- 1 | package tracer; 2 | 3 | public interface Chessboard_interface extends tracer.Materials_interface 4 | { 5 | tracer.Color_interface getColor_(java.lang.Number u, java.lang.Number v); 6 | tracer.Color_interface getColorEven(); 7 | tracer.Color_interface getColorOdd(); 8 | double getDensity(); 9 | 10 | } 11 | -------------------------------------------------------------------------------- /test/codegen_expect/richards/IdleTask_interface.java: -------------------------------------------------------------------------------- 1 | package richards; 2 | 3 | public interface IdleTask_interface extends richards.Task_interface 4 | { 5 | richards.TaskControlBlock_interface run(richards.Packet_interface packet); 6 | java.lang.String toString(); 7 | int getV1(); 8 | int getCount(); 9 | int setV1(int value); 10 | int setCount(int value); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /test/codegen_expect/richards/WorkerTask_interface.java: -------------------------------------------------------------------------------- 1 | package richards; 2 | 3 | public interface WorkerTask_interface extends richards.Task_interface 4 | { 5 | richards.TaskControlBlock_interface run(richards.Packet_interface packet); 6 | java.lang.String toString(); 7 | int getV1(); 8 | int getV2(); 9 | int setV1(int value); 10 | int setV2(int value); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /test/codegen_expect/richards/Task_interface.java: -------------------------------------------------------------------------------- 1 | package richards; 2 | 3 | public interface Task_interface extends dart._runtime.base.DartObject_interface 4 | { 5 | richards.TaskControlBlock_interface run(richards.Packet_interface packet); 6 | richards.Scheduler_interface getScheduler(); 7 | richards.Scheduler_interface setScheduler(richards.Scheduler_interface value); 8 | 9 | } 10 | -------------------------------------------------------------------------------- /test/codegen_expect/HelloWorld/__TopLevel.java: -------------------------------------------------------------------------------- 1 | package HelloWorld; 2 | 3 | public class __TopLevel 4 | { 5 | 6 | 7 | 8 | 9 | public static void main(String[] args) 10 | { 11 | final dart._runtime.types.simple.TypeEnvironment dart2java$localTypeEnv = dart._runtime.types.simple.TypeEnvironment.ROOT; 12 | dart.core.__TopLevel.print("Hello, World!"); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /test/codegen_expect/richards/DeviceTask_interface.java: -------------------------------------------------------------------------------- 1 | package richards; 2 | 3 | public interface DeviceTask_interface extends richards.Task_interface 4 | { 5 | richards.TaskControlBlock_interface run(richards.Packet_interface packet); 6 | java.lang.String toString(); 7 | richards.Packet_interface getV1(); 8 | richards.Packet_interface setV1(richards.Packet_interface value); 9 | 10 | } 11 | -------------------------------------------------------------------------------- /test/codegen_expect/is_operator_test/__TopLevel.java: -------------------------------------------------------------------------------- 1 | package is_operator_test; 2 | 3 | public class __TopLevel 4 | { 5 | 6 | 7 | 8 | 9 | public static void main(String[] args) 10 | { 11 | final dart._runtime.types.simple.TypeEnvironment dart2java$localTypeEnv = dart._runtime.types.simple.TypeEnvironment.ROOT; 12 | is_operator_test.IsOperatorTest.testMain(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /test/codegen_expect/deltablue/ScaleConstraint_interface.java: -------------------------------------------------------------------------------- 1 | package deltablue; 2 | 3 | public interface ScaleConstraint_interface extends deltablue.BinaryConstraint_interface 4 | { 5 | void addToGraph(); 6 | void removeFromGraph(); 7 | void markInputs(int mark); 8 | void execute(); 9 | void recalculate(); 10 | deltablue.Variable_interface getScale(); 11 | deltablue.Variable_interface getOffset(); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /test/codegen_expect/havlak/BasicBlockEdge_interface.java: -------------------------------------------------------------------------------- 1 | package havlak; 2 | 3 | public interface BasicBlockEdge_interface extends dart._runtime.base.DartObject_interface 4 | { 5 | havlak.BasicBlock_interface getFrom(); 6 | havlak.BasicBlock_interface getTo(); 7 | havlak.BasicBlock_interface setFrom(havlak.BasicBlock_interface value); 8 | havlak.BasicBlock_interface setTo(havlak.BasicBlock_interface value); 9 | 10 | } 11 | -------------------------------------------------------------------------------- /test/unit/for_in/scenario.dart: -------------------------------------------------------------------------------- 1 | int testForInInt() { 2 | var intList = [1, 3, 5, 1]; 3 | int accumulator = 0; 4 | 5 | for (int i in intList) { 6 | accumulator += i; 7 | } 8 | 9 | return accumulator; 10 | } 11 | 12 | String testForInStr() { 13 | var strList = ["1", "3", "5", "1"]; 14 | String accumulator = ""; 15 | 16 | for (String s in strList) { 17 | accumulator += s; 18 | } 19 | 20 | return accumulator; 21 | } 22 | -------------------------------------------------------------------------------- /test/codegen_expect/tracer/Materials_interface.java: -------------------------------------------------------------------------------- 1 | package tracer; 2 | 3 | public interface Materials_interface extends dart._runtime.base.DartObject_interface 4 | { 5 | tracer.Color_interface getColor_(java.lang.Number u, java.lang.Number v); 6 | java.lang.Object wrapUp(java.lang.Object t); 7 | double getGloss(); 8 | double getTransparency(); 9 | double getReflection(); 10 | double getRefraction(); 11 | boolean getHasTexture(); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /test/codegen_expect/havlak/BenchmarkBase_interface.java: -------------------------------------------------------------------------------- 1 | package havlak; 2 | 3 | public interface BenchmarkBase_interface extends dart._runtime.base.DartObject_interface 4 | { 5 | void run(); 6 | void warmup(); 7 | void exercise(); 8 | void setup(); 9 | void teardown(); 10 | double measureForWarumup(int timeMinimum); 11 | double measureForExercise(int timeMinimum); 12 | double measure(); 13 | void report(); 14 | java.lang.String getName(); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /test/codegen_expect/matrix/BenchmarkBase_interface.java: -------------------------------------------------------------------------------- 1 | package matrix; 2 | 3 | public interface BenchmarkBase_interface extends dart._runtime.base.DartObject_interface 4 | { 5 | void run(); 6 | void warmup(); 7 | void exercise(); 8 | void setup(); 9 | void teardown(); 10 | double measureForWarumup(int timeMinimum); 11 | double measureForExercise(int timeMinimum); 12 | double measure(); 13 | void report(); 14 | java.lang.String getName(); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /test/codegen_expect/multifile/file-imports/compiled/org/dartlang/file_import_test/at_level_0/__TopLevel.java: -------------------------------------------------------------------------------- 1 | package org.dartlang.file_import_test.at_level_0; 2 | 3 | public class __TopLevel 4 | { 5 | 6 | 7 | 8 | 9 | public static void atLevel0() 10 | { 11 | final dart._runtime.types.simple.TypeEnvironment dart2java$localTypeEnv = dart._runtime.types.simple.TypeEnvironment.ROOT; 12 | dart.core.__TopLevel.print("At level 0"); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /test/codegen_expect/tracer/BenchmarkBase_interface.java: -------------------------------------------------------------------------------- 1 | package tracer; 2 | 3 | public interface BenchmarkBase_interface extends dart._runtime.base.DartObject_interface 4 | { 5 | void run(); 6 | void warmup(); 7 | void exercise(); 8 | void setup(); 9 | void teardown(); 10 | double measureForWarumup(int timeMinimum); 11 | double measureForExercise(int timeMinimum); 12 | double measure(); 13 | void report(); 14 | java.lang.String getName(); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /test/codegen_expect/deltablue/BenchmarkBase_interface.java: -------------------------------------------------------------------------------- 1 | package deltablue; 2 | 3 | public interface BenchmarkBase_interface extends dart._runtime.base.DartObject_interface 4 | { 5 | void run(); 6 | void warmup(); 7 | void exercise(); 8 | void setup(); 9 | void teardown(); 10 | double measureForWarumup(int timeMinimum); 11 | double measureForExercise(int timeMinimum); 12 | double measure(); 13 | void report(); 14 | java.lang.String getName(); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /test/codegen_expect/gameoflife/BenchmarkBase_interface.java: -------------------------------------------------------------------------------- 1 | package gameoflife; 2 | 3 | public interface BenchmarkBase_interface extends dart._runtime.base.DartObject_interface 4 | { 5 | void run(); 6 | void warmup(); 7 | void exercise(); 8 | void setup(); 9 | void teardown(); 10 | double measureForWarumup(int timeMinimum); 11 | double measureForExercise(int timeMinimum); 12 | double measure(); 13 | void report(); 14 | java.lang.String getName(); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /test/codegen_expect/generics/Foo1_interface.java: -------------------------------------------------------------------------------- 1 | package generics; 2 | 3 | public interface Foo1_interface extends dart._runtime.base.DartObject_interface 4 | { 5 | void createInnerFoo_Foo1(); 6 | T foo_Foo1(T t); 7 | void writeVariable_Foo1(T value); 8 | T getVariable_Foo1(); 9 | generics.Foo1_interface getAnotherFoo1_Foo1(); 10 | T setVariable_Foo1(T value); 11 | generics.Foo1_interface setAnotherFoo1_Foo1(generics.Foo1_interface value); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /test/codegen_expect/richards/BenchmarkBase_interface.java: -------------------------------------------------------------------------------- 1 | package richards; 2 | 3 | public interface BenchmarkBase_interface extends dart._runtime.base.DartObject_interface 4 | { 5 | void run(); 6 | void warmup(); 7 | void exercise(); 8 | void setup(); 9 | void teardown(); 10 | double measureForWarumup(int timeMinimum); 11 | double measureForExercise(int timeMinimum); 12 | double measure(); 13 | void report(); 14 | java.lang.String getName(); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /test/codegen_expect/addition/__TopLevel.java: -------------------------------------------------------------------------------- 1 | package addition; 2 | 3 | public class __TopLevel 4 | { 5 | 6 | 7 | 8 | 9 | public static void main(String[] args) 10 | { 11 | final dart._runtime.types.simple.TypeEnvironment dart2java$localTypeEnv = dart._runtime.types.simple.TypeEnvironment.ROOT; 12 | dart.core.__TopLevel.print((2 + 2)); 13 | dart.core.__TopLevel.print((4 + dart._runtime.helpers.StringHelper.getLength("four"))); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /test/codegen_expect/barnsleyfern/BenchmarkBase_interface.java: -------------------------------------------------------------------------------- 1 | package barnsleyfern; 2 | 3 | public interface BenchmarkBase_interface extends dart._runtime.base.DartObject_interface 4 | { 5 | void run(); 6 | void warmup(); 7 | void exercise(); 8 | void setup(); 9 | void teardown(); 10 | double measureForWarumup(int timeMinimum); 11 | double measureForExercise(int timeMinimum); 12 | double measure(); 13 | void report(); 14 | java.lang.String getName(); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /test/codegen_expect/deltablue/Plan_interface.java: -------------------------------------------------------------------------------- 1 | package deltablue; 2 | 3 | public interface Plan_interface extends dart._runtime.base.DartObject_interface 4 | { 5 | void addConstraint(deltablue.Constraint_interface c); 6 | int size(); 7 | void execute(); 8 | dart.core.List_interface getList(); 9 | dart.core.List_interface setList(dart.core.List_interface value); 10 | 11 | } 12 | -------------------------------------------------------------------------------- /test/codegen_expect/fluidmotion/BenchmarkBase_interface.java: -------------------------------------------------------------------------------- 1 | package fluidmotion; 2 | 3 | public interface BenchmarkBase_interface extends dart._runtime.base.DartObject_interface 4 | { 5 | void run(); 6 | void warmup(); 7 | void exercise(); 8 | void setup(); 9 | void teardown(); 10 | double measureForWarumup(int timeMinimum); 11 | double measureForExercise(int timeMinimum); 12 | double measure(); 13 | void report(); 14 | java.lang.String getName(); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /test/codegen_expect/diamondsquare/BenchmarkBase_interface.java: -------------------------------------------------------------------------------- 1 | package diamondsquare; 2 | 3 | public interface BenchmarkBase_interface extends dart._runtime.base.DartObject_interface 4 | { 5 | void run(); 6 | void warmup(); 7 | void exercise(); 8 | void setup(); 9 | void teardown(); 10 | double measureForWarumup(int timeMinimum); 11 | double measureForExercise(int timeMinimum); 12 | double measure(); 13 | void report(); 14 | java.lang.String getName(); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /benchmark/java-invokes/java-invokes.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /test/codegen_expect/multifile/file-imports/compiled/org/dartlang/file_import_test/level_1/at_level_1/__TopLevel.java: -------------------------------------------------------------------------------- 1 | package org.dartlang.file_import_test.level_1.at_level_1; 2 | 3 | public class __TopLevel 4 | { 5 | 6 | 7 | 8 | 9 | public static void atLevel1() 10 | { 11 | final dart._runtime.types.simple.TypeEnvironment dart2java$localTypeEnv = dart._runtime.types.simple.TypeEnvironment.ROOT; 12 | dart.core.__TopLevel.print("At level 1"); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /test/codegen_expect/multifile/file-imports/compiled/org/dartlang/file_import_test/other_1/at_other_1/__TopLevel.java: -------------------------------------------------------------------------------- 1 | package org.dartlang.file_import_test.other_1.at_other_1; 2 | 3 | public class __TopLevel 4 | { 5 | 6 | 7 | 8 | 9 | public static void atOther1() 10 | { 11 | final dart._runtime.types.simple.TypeEnvironment dart2java$localTypeEnv = dart._runtime.types.simple.TypeEnvironment.ROOT; 12 | dart.core.__TopLevel.print("At other 1"); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /test/codegen_expect/havlak/LSG_interface.java: -------------------------------------------------------------------------------- 1 | package havlak; 2 | 3 | public interface LSG_interface extends dart._runtime.base.DartObject_interface 4 | { 5 | havlak.SimpleLoop_interface createNewLoop(); 6 | boolean addLoop(havlak.SimpleLoop_interface loop); 7 | int checksum(); 8 | int getNumLoops(); 9 | int getLoopCounter(); 10 | dart.core.List_interface getLoops(); 11 | havlak.SimpleLoop_interface getRoot(); 12 | int setLoopCounter(int value); 13 | 14 | } 15 | -------------------------------------------------------------------------------- /test/codegen_expect/multifile/file-imports/compiled/org/dartlang/file_import_test/level_1/level_2/at_level_2/__TopLevel.java: -------------------------------------------------------------------------------- 1 | package org.dartlang.file_import_test.level_1.level_2.at_level_2; 2 | 3 | public class __TopLevel 4 | { 5 | 6 | 7 | 8 | 9 | public static void atLevel2() 10 | { 11 | final dart._runtime.types.simple.TypeEnvironment dart2java$localTypeEnv = dart._runtime.types.simple.TypeEnvironment.ROOT; 12 | dart.core.__TopLevel.print("At level 2"); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /test/codegen_expect/richards/HandlerTask_interface.java: -------------------------------------------------------------------------------- 1 | package richards; 2 | 3 | public interface HandlerTask_interface extends richards.Task_interface 4 | { 5 | richards.TaskControlBlock_interface run(richards.Packet_interface packet); 6 | java.lang.String toString(); 7 | richards.Packet_interface getV1(); 8 | richards.Packet_interface getV2(); 9 | richards.Packet_interface setV1(richards.Packet_interface value); 10 | richards.Packet_interface setV2(richards.Packet_interface value); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /test/codegen_failures.txt: -------------------------------------------------------------------------------- 1 | // This file contains the name of codegen tests which are expected to fail and 2 | // should be skipped during testing. These tests can be forcibly run by passing 3 | // a --force flag to test/all_tests.dart or test/codegen_test.dart. 4 | // 5 | // Only // comments are allowed in this file and empty lines are ignored. 6 | // Provide one test name per line. 7 | 8 | BardCount // This test is speculative and we don't expect to pass it soon. 9 | classes // Broken until List and Map handle type parameters correctly. -------------------------------------------------------------------------------- /test/codegen_expect/tracer/Scene_interface.java: -------------------------------------------------------------------------------- 1 | package tracer; 2 | 3 | public interface Scene_interface extends dart._runtime.base.DartObject_interface 4 | { 5 | java.lang.Object getCamera(); 6 | java.lang.Object getShapes(); 7 | java.lang.Object getLights(); 8 | java.lang.Object getBackground(); 9 | java.lang.Object setCamera(java.lang.Object value); 10 | java.lang.Object setShapes(java.lang.Object value); 11 | java.lang.Object setLights(java.lang.Object value); 12 | java.lang.Object setBackground(java.lang.Object value); 13 | 14 | } 15 | -------------------------------------------------------------------------------- /test/codegen_expect/tracer/Camera_interface.java: -------------------------------------------------------------------------------- 1 | package tracer; 2 | 3 | public interface Camera_interface extends dart._runtime.base.DartObject_interface 4 | { 5 | tracer.Ray_interface getRay(double vx, double vy); 6 | java.lang.String toString(); 7 | java.lang.Object getPosition(); 8 | java.lang.Object getLookAt(); 9 | java.lang.Object getUp(); 10 | java.lang.Object getEquator(); 11 | java.lang.Object getScreen(); 12 | java.lang.Object setEquator(java.lang.Object value); 13 | java.lang.Object setScreen(java.lang.Object value); 14 | 15 | } 16 | -------------------------------------------------------------------------------- /test/codegen_expect/havlak/HavlakLoopFinder_interface.java: -------------------------------------------------------------------------------- 1 | package havlak; 2 | 3 | public interface HavlakLoopFinder_interface extends dart._runtime.base.DartObject_interface 4 | { 5 | boolean isAncestor(int w, int v, dart.core.List_interface__int last); 6 | int DFS(havlak.BasicBlock_interface currentNode, dart.core.List_interface nodes, dart.core.List_interface__int number, dart.core.List_interface__int last, int current); 7 | int findLoops(); 8 | havlak.CFG_interface getCfg(); 9 | havlak.LSG_interface getLsg(); 10 | 11 | } 12 | -------------------------------------------------------------------------------- /test/codegen_expect/fluidmotion/Field_interface.java: -------------------------------------------------------------------------------- 1 | package fluidmotion; 2 | 3 | public interface Field_interface extends dart._runtime.base.DartObject_interface 4 | { 5 | void setDensity(int x, int y, double d); 6 | double getDensity(int x, int y); 7 | void setVelocity(int x, int y, double xv, double yv); 8 | double getXVelocity(int x, int y); 9 | double getYVelocity(int x, int y); 10 | dart.core.List_interface__double getDens(); 11 | dart.core.List_interface__double getU(); 12 | dart.core.List_interface__double getV(); 13 | int getRowSize(); 14 | 15 | } 16 | -------------------------------------------------------------------------------- /test/codegen_expect/deltablue/UnaryConstraint_interface.java: -------------------------------------------------------------------------------- 1 | package deltablue; 2 | 3 | public interface UnaryConstraint_interface extends deltablue.Constraint_interface 4 | { 5 | void addToGraph(); 6 | void chooseMethod(int mark); 7 | boolean isSatisfied(); 8 | void markInputs(int mark); 9 | deltablue.Variable_interface output(); 10 | void recalculate(); 11 | void markUnsatisfied(); 12 | boolean inputsKnown(int mark); 13 | void removeFromGraph(); 14 | deltablue.Variable_interface getMyOutput(); 15 | boolean getSatisfied(); 16 | boolean setSatisfied(boolean value); 17 | 18 | } 19 | -------------------------------------------------------------------------------- /test/codegen_expect/fluidmotion/__TopLevel.java: -------------------------------------------------------------------------------- 1 | package fluidmotion; 2 | 3 | public class __TopLevel 4 | { 5 | private static dart._runtime.types.simple.InterfaceTypeExpr dart2java$typeExpr_FluidMotion = new dart._runtime.types.simple.InterfaceTypeExpr(fluidmotion.FluidMotion.dart2java$typeInfo); 6 | 7 | 8 | 9 | public static void main(String[] args) 10 | { 11 | final dart._runtime.types.simple.TypeEnvironment dart2java$localTypeEnv = dart._runtime.types.simple.TypeEnvironment.ROOT; 12 | fluidmotion.FluidMotion._new_FluidMotion$(dart2java$localTypeEnv.evaluate(dart2java$typeExpr_FluidMotion)).report(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /test/codegen_expect/tracer/Color_interface.java: -------------------------------------------------------------------------------- 1 | package tracer; 2 | 3 | public interface Color_interface extends dart._runtime.base.DartObject_interface 4 | { 5 | tracer.Color_interface limit(); 6 | tracer.Color_interface operatorPlus(tracer.Color_interface c2); 7 | tracer.Color_interface addScalar(double s); 8 | tracer.Color_interface operatorStar(tracer.Color_interface c2); 9 | tracer.Color_interface multiplyScalar(double f); 10 | tracer.Color_interface blend(tracer.Color_interface c2, double w); 11 | int brightness(); 12 | java.lang.String toString(); 13 | double getRed(); 14 | double getGreen(); 15 | double getBlue(); 16 | 17 | } 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Don’t commit the following files and directories created by pub. 2 | .pub 3 | build/ 4 | packages 5 | .packages 6 | 7 | # Ignore files created by tools. 8 | *.dart.precompiled.js 9 | *.js_ 10 | *.js.deps 11 | *.sw? 12 | .idea/ 13 | .pub/ 14 | node_modules 15 | doc/api/ 16 | 17 | # Generated files go here. 18 | gen/ 19 | 20 | # Ignore generated summary. 21 | lib/runtime/dart_sdk.sum 22 | 23 | # Ignore generated .class and .jar files, even in the codegen_expect directory. 24 | *.class 25 | *.jar 26 | 27 | # Don't ignore .jar files in third_party 28 | !/third_party/**/*.jar 29 | 30 | # Created by ./tool/dependency_overrides.sh. 31 | dependency_overrides/ 32 | -------------------------------------------------------------------------------- /test/codegen_expect/richards/Packet_interface.java: -------------------------------------------------------------------------------- 1 | package richards; 2 | 3 | public interface Packet_interface extends dart._runtime.base.DartObject_interface 4 | { 5 | richards.Packet_interface addTo(richards.Packet_interface queue); 6 | java.lang.String toString(); 7 | richards.Packet_interface getLink(); 8 | int getId(); 9 | int getKind(); 10 | int getA1(); 11 | dart.core.List_interface__int getA2(); 12 | richards.Packet_interface setLink(richards.Packet_interface value); 13 | int setId(int value); 14 | int setKind(int value); 15 | int setA1(int value); 16 | dart.core.List_interface__int setA2(dart.core.List_interface__int value); 17 | 18 | } 19 | -------------------------------------------------------------------------------- /test/codegen/import/foo.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2016, the Dart project authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | foo() {} 16 | -------------------------------------------------------------------------------- /test/codegen/minimal.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2016, the Dart project authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | main() {} 16 | -------------------------------------------------------------------------------- /test/codegen_expect/deltablue/Constraint_interface.java: -------------------------------------------------------------------------------- 1 | package deltablue; 2 | 3 | public interface Constraint_interface extends dart._runtime.base.DartObject_interface 4 | { 5 | boolean isSatisfied(); 6 | void markUnsatisfied(); 7 | void addToGraph(); 8 | void removeFromGraph(); 9 | void chooseMethod(int mark); 10 | void markInputs(int mark); 11 | boolean inputsKnown(int mark); 12 | deltablue.Variable_interface output(); 13 | void execute(); 14 | void recalculate(); 15 | void addConstraint(); 16 | deltablue.Constraint_interface satisfy(int mark); 17 | void destroyConstraint(); 18 | boolean isInput(); 19 | deltablue.Strength_interface getStrength(); 20 | 21 | } 22 | -------------------------------------------------------------------------------- /test/codegen_expect/gameoflife/Culture_interface.java: -------------------------------------------------------------------------------- 1 | package gameoflife; 2 | 3 | public interface Culture_interface extends dart._runtime.base.DartObject_interface 4 | { 5 | void initPopulation(int Pop); 6 | void add(java.lang.Object x, java.lang.Object y); 7 | void update(); 8 | dart.core.Map_interface getCellDish(); 9 | int getWidth(); 10 | dart.math.Random_interface getRng(); 11 | dart.core.Map_interface setCellDish(dart.core.Map_interface value); 12 | int setWidth(int value); 13 | dart.math.Random_interface setRng(dart.math.Random_interface value); 14 | 15 | } 16 | -------------------------------------------------------------------------------- /test/codegen_expect/matrix/__TopLevel.java: -------------------------------------------------------------------------------- 1 | package matrix; 2 | 3 | public class __TopLevel 4 | { 5 | private static dart._runtime.types.simple.InterfaceTypeExpr dart2java$typeExpr_Matrix = new dart._runtime.types.simple.InterfaceTypeExpr(matrix.Matrix.dart2java$typeInfo); 6 | 7 | 8 | 9 | public static void main(String[] args) 10 | { 11 | final dart._runtime.types.simple.TypeEnvironment dart2java$localTypeEnv = dart._runtime.types.simple.TypeEnvironment.ROOT; 12 | dart.core.__TopLevel.print("Running benchmark..."); 13 | matrix.Matrix._new_Matrix$(dart2java$localTypeEnv.evaluate(dart2java$typeExpr_Matrix)).report(); 14 | dart.core.__TopLevel.print("Done."); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /test/codegen/HelloWorld.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2016, the Dart project authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | main() { 16 | print("Hello, World!"); 17 | } 18 | -------------------------------------------------------------------------------- /test/codegen_expect/richards/__TopLevel.java: -------------------------------------------------------------------------------- 1 | package richards; 2 | 3 | public class __TopLevel 4 | { 5 | private static dart._runtime.types.simple.InterfaceTypeExpr dart2java$typeExpr_Richards = new dart._runtime.types.simple.InterfaceTypeExpr(richards.Richards.dart2java$typeInfo); 6 | 7 | 8 | 9 | public static void main(String[] args) 10 | { 11 | final dart._runtime.types.simple.TypeEnvironment dart2java$localTypeEnv = dart._runtime.types.simple.TypeEnvironment.ROOT; 12 | dart.core.__TopLevel.print("Running benchmark..."); 13 | richards.Richards._new_Richards$(dart2java$localTypeEnv.evaluate(dart2java$typeExpr_Richards)).report(); 14 | dart.core.__TopLevel.print("Done."); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /tool/input_sdk/lib/core/null.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2016, the Dart project authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | part of dart.core; 16 | 17 | class Null {} 18 | -------------------------------------------------------------------------------- /tool/input_sdk/lib/core/type.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2016, the Dart project authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | part of dart.core; 16 | 17 | class Type {} 18 | -------------------------------------------------------------------------------- /test/codegen/import/bar.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2016, the Dart project authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import 'foo.dart'; 16 | 17 | bar() { 18 | foo(); 19 | } 20 | -------------------------------------------------------------------------------- /tool/input_sdk/lib/core/function.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2016, the Dart project authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | part of dart.core; 16 | 17 | class Function {} 18 | -------------------------------------------------------------------------------- /tool/input_sdk/lib/core/symbol.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2016, the Dart project authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | part of dart.core; 16 | 17 | class Symbol {} 18 | -------------------------------------------------------------------------------- /test/codegen_expect/barnsleyfern/__TopLevel.java: -------------------------------------------------------------------------------- 1 | package barnsleyfern; 2 | 3 | public class __TopLevel 4 | { 5 | private static dart._runtime.types.simple.InterfaceTypeExpr dart2java$typeExpr_Fractal = new dart._runtime.types.simple.InterfaceTypeExpr(barnsleyfern.Fractal.dart2java$typeInfo); 6 | 7 | 8 | 9 | public static void main(String[] args) 10 | { 11 | final dart._runtime.types.simple.TypeEnvironment dart2java$localTypeEnv = dart._runtime.types.simple.TypeEnvironment.ROOT; 12 | dart.core.__TopLevel.print("Running benchmark..."); 13 | barnsleyfern.Fractal._new_Fractal$(dart2java$localTypeEnv.evaluate(dart2java$typeExpr_Fractal)).report(); 14 | dart.core.__TopLevel.print("Done."); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /tool/input_sdk/lib/async/future.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2016, the Dart project authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | part of dart.async; 16 | 17 | class Future {} 18 | -------------------------------------------------------------------------------- /tool/input_sdk/lib/async/stream.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2016, the Dart project authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | part of dart.async; 16 | 17 | class Stream {} 18 | -------------------------------------------------------------------------------- /test/codegen/addition.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2016, the Dart project authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | void main() { 16 | print(2+2); 17 | print(4 + "four".length); 18 | } 19 | -------------------------------------------------------------------------------- /test/codegen_expect/tracer/Vector_interface.java: -------------------------------------------------------------------------------- 1 | package tracer; 2 | 3 | public interface Vector_interface extends dart._runtime.base.DartObject_interface 4 | { 5 | tracer.Vector_interface normalize(); 6 | tracer.Vector_interface negateY(); 7 | double magnitude(); 8 | tracer.Vector_interface cross(tracer.Vector_interface w); 9 | double dot(tracer.Vector_interface w); 10 | tracer.Vector_interface operatorPlus(tracer.Vector_interface w); 11 | tracer.Vector_interface operatorMinus(tracer.Vector_interface w); 12 | tracer.Vector_interface operatorStar(tracer.Vector_interface w); 13 | tracer.Vector_interface multiplyScalar(double w); 14 | java.lang.String toString(); 15 | double getX(); 16 | double getY(); 17 | double getZ(); 18 | 19 | } 20 | -------------------------------------------------------------------------------- /test/codegen/multifile/file-imports/at_level_0.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2016, the Dart project authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | void atLevel0() { 16 | print("At level 0"); 17 | } 18 | -------------------------------------------------------------------------------- /test/codegen_expect/multifile/file-imports/compiled/org/dartlang/file_import_test/level_1/main/__TopLevel.java: -------------------------------------------------------------------------------- 1 | package org.dartlang.file_import_test.level_1.main; 2 | 3 | public class __TopLevel 4 | { 5 | 6 | 7 | 8 | 9 | public static void main(String[] args) 10 | { 11 | final dart._runtime.types.simple.TypeEnvironment dart2java$localTypeEnv = dart._runtime.types.simple.TypeEnvironment.ROOT; 12 | org.dartlang.file_import_test.level_1.at_level_1.__TopLevel.atLevel1(); 13 | org.dartlang.file_import_test.level_1.level_2.at_level_2.__TopLevel.atLevel2(); 14 | org.dartlang.file_import_test.at_level_0.__TopLevel.atLevel0(); 15 | org.dartlang.file_import_test.other_1.at_other_1.__TopLevel.atOther1(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /test/codegen/multifile/file-imports/level_1/at_level_1.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2016, the Dart project authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | void atLevel1() { 16 | print("At level 1"); 17 | } 18 | -------------------------------------------------------------------------------- /test/codegen/multifile/file-imports/other_1/at_other_1.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2016, the Dart project authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | void atOther1() { 16 | print("At other 1"); 17 | } 18 | -------------------------------------------------------------------------------- /test/codegen_expect/havlak/CFG_interface.java: -------------------------------------------------------------------------------- 1 | package havlak; 2 | 3 | public interface CFG_interface extends dart._runtime.base.DartObject_interface 4 | { 5 | havlak.BasicBlock_interface createNode(int name); 6 | boolean addEdge(havlak.BasicBlockEdge_interface edge); 7 | int getNumNodes(); 8 | havlak.BasicBlock_interface getDst(havlak.BasicBlockEdge_interface edge); 9 | havlak.BasicBlock_interface getSrc(havlak.BasicBlockEdge_interface edge); 10 | dart.core.Map_interface__int_generic getBasicBlockMap(); 11 | dart.core.List_interface getEdgeList(); 12 | havlak.BasicBlock_interface getStartNode(); 13 | havlak.BasicBlock_interface setStartNode(havlak.BasicBlock_interface value); 14 | 15 | } 16 | -------------------------------------------------------------------------------- /tool/input_sdk/lib/async/async.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2016, the Dart project authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | library dart.async; 16 | 17 | part 'future.dart'; 18 | part 'stream.dart'; 19 | -------------------------------------------------------------------------------- /test/codegen/multifile/file-imports/level_1/level_2/at_level_2.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2016, the Dart project authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | void atLevel2() { 16 | print("At level 2"); 17 | } 18 | -------------------------------------------------------------------------------- /test/codegen_expect/diamondsquare/__TopLevel.java: -------------------------------------------------------------------------------- 1 | package diamondsquare; 2 | 3 | public class __TopLevel 4 | { 5 | private static dart._runtime.types.simple.InterfaceTypeExpr dart2java$typeExpr_DiamondSquare = new dart._runtime.types.simple.InterfaceTypeExpr(diamondsquare.DiamondSquare.dart2java$typeInfo); 6 | 7 | 8 | 9 | public static void main(String[] args) 10 | { 11 | final dart._runtime.types.simple.TypeEnvironment dart2java$localTypeEnv = dart._runtime.types.simple.TypeEnvironment.ROOT; 12 | dart.core.__TopLevel.print("Running benchmark..."); 13 | diamondsquare.DiamondSquare._new_DiamondSquare$(dart2java$localTypeEnv.evaluate(dart2java$typeExpr_DiamondSquare)).report(); 14 | dart.core.__TopLevel.print("Done."); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /tool/input_sdk/lib/internal/internal.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2016, the Dart project authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | library dart._internal; 16 | 17 | // Internal Symbol class; part of standard Dart SDK. 18 | class Symbol {} 19 | -------------------------------------------------------------------------------- /test/codegen_expect/havlak/BasicBlock_interface.java: -------------------------------------------------------------------------------- 1 | package havlak; 2 | 3 | public interface BasicBlock_interface extends dart._runtime.base.DartObject_interface 4 | { 5 | java.lang.String toString(); 6 | int getNumPred(); 7 | int getNumSucc(); 8 | boolean addInEdge(havlak.BasicBlock_interface bb); 9 | boolean addOutEdge(havlak.BasicBlock_interface bb); 10 | int getName(); 11 | dart.core.List_interface getInEdges(); 12 | dart.core.List_interface getOutEdges(); 13 | dart.core.List_interface setInEdges(dart.core.List_interface value); 14 | dart.core.List_interface setOutEdges(dart.core.List_interface value); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /test/codegen_expect/tracer/IntersectionInfo_interface.java: -------------------------------------------------------------------------------- 1 | package tracer; 2 | 3 | public interface IntersectionInfo_interface extends dart._runtime.base.DartObject_interface 4 | { 5 | java.lang.String toString(); 6 | boolean getIsHit(); 7 | int getHitCount(); 8 | java.lang.Object getShape(); 9 | java.lang.Object getPosition(); 10 | java.lang.Object getNormal(); 11 | java.lang.Object getColor(); 12 | java.lang.Object getDistance(); 13 | boolean setIsHit(boolean value); 14 | int setHitCount(int value); 15 | java.lang.Object setShape(java.lang.Object value); 16 | java.lang.Object setPosition(java.lang.Object value); 17 | java.lang.Object setNormal(java.lang.Object value); 18 | java.lang.Object setColor(java.lang.Object value); 19 | java.lang.Object setDistance(java.lang.Object value); 20 | 21 | } 22 | -------------------------------------------------------------------------------- /test/codegen_expect/deltablue/BinaryConstraint_interface.java: -------------------------------------------------------------------------------- 1 | package deltablue; 2 | 3 | public interface BinaryConstraint_interface extends deltablue.Constraint_interface 4 | { 5 | void chooseMethod(int mark); 6 | void addToGraph(); 7 | boolean isSatisfied(); 8 | void markInputs(int mark); 9 | deltablue.Variable_interface input(); 10 | deltablue.Variable_interface output(); 11 | void recalculate(); 12 | void markUnsatisfied(); 13 | boolean inputsKnown(int mark); 14 | void removeFromGraph(); 15 | deltablue.Variable_interface getV1(); 16 | deltablue.Variable_interface getV2(); 17 | int getDirection(); 18 | deltablue.Variable_interface setV1(deltablue.Variable_interface value); 19 | deltablue.Variable_interface setV2(deltablue.Variable_interface value); 20 | int setDirection(int value); 21 | 22 | } 23 | -------------------------------------------------------------------------------- /test/codegen_expect/diamondsquare/World_interface.java: -------------------------------------------------------------------------------- 1 | package diamondsquare; 2 | 3 | public interface World_interface extends dart._runtime.base.DartObject_interface 4 | { 5 | void Reset(); 6 | void Base(); 7 | void SetCorners(int x, int y, int w, int h, dart.core.List_interface__int v); 8 | void Generate(); 9 | void Smooth(); 10 | int getWidth(); 11 | int getLength(); 12 | dart.math.Random_interface getRng(); 13 | int getIterations(); 14 | dart.core.List_interface getMap_data(); 15 | int setWidth(int value); 16 | int setLength(int value); 17 | dart.math.Random_interface setRng(dart.math.Random_interface value); 18 | int setIterations(int value); 19 | dart.core.List_interface setMap_data(dart.core.List_interface value); 20 | 21 | } 22 | -------------------------------------------------------------------------------- /test/codegen_expect/gameoflife/Cell_interface.java: -------------------------------------------------------------------------------- 1 | package gameoflife; 2 | 3 | public interface Cell_interface extends dart._runtime.base.DartObject_interface 4 | { 5 | void update(); 6 | void commit(); 7 | int getNeighbours(); 8 | boolean isNeighbourPopulated(int nx, int ny); 9 | int getX(); 10 | int getY(); 11 | dart.core.Map_interface getEnvironment(); 12 | int getState(); 13 | int getNextState(); 14 | int getAge(); 15 | int getUpdates(); 16 | int setX(int value); 17 | int setY(int value); 18 | dart.core.Map_interface setEnvironment(dart.core.Map_interface value); 19 | int setState(int value); 20 | int setNextState(int value); 21 | int setAge(int value); 22 | int setUpdates(int value); 23 | 24 | } 25 | -------------------------------------------------------------------------------- /test/codegen_expect/havlak/UnionFindNode_interface.java: -------------------------------------------------------------------------------- 1 | package havlak; 2 | 3 | public interface UnionFindNode_interface extends dart._runtime.base.DartObject_interface 4 | { 5 | void initNode(havlak.BasicBlock_interface bb, int dfsNumber); 6 | havlak.UnionFindNode_interface findSet(); 7 | void union(havlak.UnionFindNode_interface unionFindNode); 8 | havlak.SimpleLoop_interface setLoop_(havlak.SimpleLoop_interface l); 9 | int getDfsNumber(); 10 | havlak.UnionFindNode_interface getParent(); 11 | havlak.BasicBlock_interface getBb(); 12 | havlak.SimpleLoop_interface getLoop(); 13 | int setDfsNumber(int value); 14 | havlak.UnionFindNode_interface setParent(havlak.UnionFindNode_interface value); 15 | havlak.BasicBlock_interface setBb(havlak.BasicBlock_interface value); 16 | havlak.SimpleLoop_interface setLoop(havlak.SimpleLoop_interface value); 17 | 18 | } 19 | -------------------------------------------------------------------------------- /tool/sdk_impl/java/dart/_runtime/helpers/ConstructorHelper.java: -------------------------------------------------------------------------------- 1 | // Copyright 2016, the Dart project authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package dart._runtime.helpers; 16 | 17 | public class ConstructorHelper { 18 | public static class EmptyConstructorMarker { 19 | 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /test/codegen/specialized_list.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2016, the Dart project authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | void main() { 16 | print("Expect output 5, 7, 9"); 17 | 18 | var intList = [5, 7, 9]; 19 | for (int i = 0; i < intList.length; i++) { 20 | print(intList[i]); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /tool/input_sdk/lib/core/object.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2016, the Dart project authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | part of dart.core; 16 | 17 | class Object { 18 | const Object(); 19 | 20 | external bool operator ==(other); 21 | 22 | external int get hashCode; 23 | 24 | external String toString(); 25 | } 26 | 27 | -------------------------------------------------------------------------------- /tool/patch_sdk.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright 2016, the Dart project authors. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | set -e 17 | 18 | cd "$(dirname "$BASH_SOURCE[0]")/.." 19 | 20 | rm -rf gen/patched_sdk 21 | dart -c tool/patch_sdk.dart tool/input_sdk gen/patched_sdk 22 | cp -r tool/input_sdk/internal/*.dart gen/patched_sdk/lib/internal/ 23 | -------------------------------------------------------------------------------- /benchmark/java-invokes/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright 2016, the Dart project authors. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | cd $(dirname "$0") 17 | rm -rf out 18 | cd src 19 | javac *.java 20 | cd .. 21 | # Simulate IntelliJ's output structure. 22 | OUT_DIR=out/production/java-invokes 23 | mkdir -p $OUT_DIR 24 | mv src/*.class $OUT_DIR 25 | -------------------------------------------------------------------------------- /tool/sdk_impl/java/dart/_runtime/helpers/LetExpressionHelper.java: -------------------------------------------------------------------------------- 1 | // Copyright 2016, the Dart project authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package dart._runtime.helpers; 16 | 17 | public class LetExpressionHelper { 18 | public static T comma(@SuppressWarnings("unused") S s, T t) { 19 | return t; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: dart 2 | dart: 3 | - dev 4 | cache: 5 | directories: 6 | - $HOME/.npm 7 | - $HOME/.nvm 8 | - $HOME/.pub-cache/hosted 9 | - node_modules 10 | before_install: 11 | - test "$ANALYZER" != master || ./tool/override_analyzer_dependency.sh 12 | - pub global activate dart_coveralls 13 | - export CHROME_CANARY_BIN=`./tool/get_chrome_canary.sh` 14 | - export DISPLAY=:99.0 15 | - sh -e /etc/init.d/xvfb start 16 | before_script: 17 | - nvm install 5.5.0 18 | - npm install 19 | script: 20 | - if [[ -z "$TEST" ]]; then ./tool/presubmit.sh ; fi 21 | - if [[ "$TEST" == coverage ]]; then ./tool/build_sdk.sh && ./tool/coverage.sh ; fi 22 | - if [[ "$TEST" == node ]]; then ./tool/node_test.sh ; fi 23 | env: 24 | - ANALYZER=stable 25 | - ANALYZER=master 26 | - TEST=coverage 27 | - TEST=node 28 | matrix: 29 | allow_failures: 30 | - env: ANALYZER=master 31 | - env: TEST=node 32 | -------------------------------------------------------------------------------- /test/codegen_expect/deltablue/Planner_interface.java: -------------------------------------------------------------------------------- 1 | package deltablue; 2 | 3 | public interface Planner_interface extends dart._runtime.base.DartObject_interface 4 | { 5 | void incrementalAdd(deltablue.Constraint_interface c); 6 | void incrementalRemove(deltablue.Constraint_interface c); 7 | int newMark(); 8 | deltablue.Plan_interface makePlan(dart.core.List_interface sources); 9 | deltablue.Plan_interface extractPlanFromConstraints(dart.core.List_interface constraints); 10 | boolean addPropagate(deltablue.Constraint_interface c, int mark); 11 | dart.core.List_interface removePropagateFrom(deltablue.Variable_interface out); 12 | void addConstraintsConsumingTo(deltablue.Variable_interface v, dart.core.List_interface coll); 13 | int getCurrentMark(); 14 | int setCurrentMark(int value); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /test/codegen/multifile/file-imports/level_1/main.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2016, the Dart project authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import 'at_level_1.dart'; 16 | import 'level_2/at_level_2.dart'; 17 | import '../at_level_0.dart'; 18 | import '../other_1/at_other_1.dart'; 19 | 20 | void main() { 21 | atLevel1(); 22 | atLevel2(); 23 | atLevel0(); 24 | atOther1(); 25 | } 26 | 27 | -------------------------------------------------------------------------------- /benchmark/analysis/plot-cmp.gnuplot: -------------------------------------------------------------------------------- 1 | files = "results/iv-cmp results/ii-cmp results/1a-cmp results/1b-cmp results/1c-cmp results/min-max-cmp" 2 | 3 | set terminal png size 1680,1050 4 | set yrange [0.1:100] 5 | set key outside 6 | set datafile separator ',' 7 | set logscale y 8 | 9 | set output 'results/iv-cmp.png' 10 | plot word(files, 1).'.csv' using 0:1, word(files, 1).'.csv' using 0:2, word(files, 1).'.csv' using 0:3 11 | 12 | set output 'results/ii-cmp.png' 13 | plot word(files, 2).'.csv' using 0:1, word(files, 2).'.csv' using 0:2, word(files, 2).'.csv' using 0:3 14 | 15 | set output 'results/1a-cmp.png' 16 | plot word(files, 3).'.csv' using 0:1, word(files, 3).'.csv' using 0:2, word(files, 3).'.csv' using 0:3 17 | 18 | set output 'results/1b-cmp.png' 19 | plot word(files, 4).'.csv' using 0:1 20 | 21 | set output 'results/1c-cmp.png' 22 | plot word(files, 5).'.csv' using 0:1 23 | 24 | set output 'results/min-max-cmp.png' 25 | plot word(files, 6).'.csv' using 0:1 26 | -------------------------------------------------------------------------------- /test/unit/arguments/scenario.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2016, the Dart project authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | int funcWithOptionalArgs(int a, int b, [int c = 3]) { 16 | return a + b * 10 + c * 100; 17 | } 18 | 19 | int callFuncWithoutOptionalArg() { 20 | return funcWithOptionalArgs(1, 2); 21 | } 22 | 23 | int callFuncWithOptionalArg() { 24 | return funcWithOptionalArgs(1, 2, 4); 25 | } 26 | -------------------------------------------------------------------------------- /tool/sdk_impl/java/dart/_runtime/base/DartObject_interface.java: -------------------------------------------------------------------------------- 1 | // Copyright 2016, the Dart project authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package dart._runtime.base; 16 | 17 | public interface DartObject_interface { 18 | public int getHashCode(); 19 | 20 | public boolean operatorEqual(Object other); 21 | 22 | @Override 23 | public String toString(); 24 | 25 | public void _constructor(); 26 | } 27 | -------------------------------------------------------------------------------- /test/unit/map/scenario.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2016, the Dart project authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | int readWriteMap() { 16 | var map = new Map(); 17 | map["a"] = 10; 18 | map["b"] = 30; 19 | map["b"] = 35; 20 | map["c"] = 40; 21 | 22 | int result = 0; 23 | result = result + map["a"]; 24 | result = result + 2 * map["b"]; 25 | result = result + 3 * map["c"]; 26 | return result; 27 | } -------------------------------------------------------------------------------- /test/unit/basic/scenario.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2016, the Dart project authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | String helloWorld() { 16 | return "Hello World!"; 17 | } 18 | 19 | class Class1 { 20 | int x = 0; 21 | int y = 0; 22 | 23 | int getSetVars(int a) { 24 | return x = y = a; 25 | } 26 | } 27 | 28 | int setReturnMultipleFields(int a) { 29 | var x = new Class1(); 30 | return x.getSetVars(12); 31 | } 32 | -------------------------------------------------------------------------------- /tool/presubmit.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright 2016, the Dart project authors. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | fail() { 17 | printf "\n\n\e[31m*** Presubmit failed. ***\e[0m\n" 18 | exit 1 19 | } 20 | 21 | cd "$(dirname "${BASH_SOURCE[0]}")/.." 22 | tool/format.sh || fail 23 | tool/analyze.sh || fail 24 | tool/build_sdk.sh || fail 25 | tool/test.sh || fail 26 | 27 | printf "\n\n\e[32m*** Presubmit finished successfully! ***\e[0m\n" 28 | -------------------------------------------------------------------------------- /test/unit/top_level/scenario.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2016, the Dart project authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | int var1 = 10; 16 | int var2 = 0; 17 | 18 | int method1() { 19 | return 5; 20 | } 21 | 22 | int getVar1() { 23 | return var1; 24 | } 25 | 26 | void setVar2(int value) { 27 | var2 = value; 28 | } 29 | 30 | int getVar2() { 31 | return var2; 32 | } 33 | 34 | int callVar1Getter() { 35 | return getVar1(); 36 | } 37 | -------------------------------------------------------------------------------- /tool/sdk_impl/java/dart/_runtime/helpers/StopwatchHelper.java: -------------------------------------------------------------------------------- 1 | // Copyright 2016, the Dart project authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package dart._runtime.helpers; 16 | 17 | public class StopwatchHelper { 18 | public static void initTicker() { 19 | dart.core.Stopwatch._frequency = 1000 * 1000; 20 | } 21 | 22 | public static int now() { 23 | return (int)((System.nanoTime() + 500L) / 1000L); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /test/codegen_expect/deltablue/Variable_interface.java: -------------------------------------------------------------------------------- 1 | package deltablue; 2 | 3 | public interface Variable_interface extends dart._runtime.base.DartObject_interface 4 | { 5 | void addConstraint(deltablue.Constraint_interface c); 6 | void removeConstraint(deltablue.Constraint_interface c); 7 | dart.core.List_interface getConstraints(); 8 | deltablue.Constraint_interface getDeterminedBy(); 9 | int getMark(); 10 | deltablue.Strength_interface getWalkStrength(); 11 | boolean getStay(); 12 | int getValue(); 13 | java.lang.String getName(); 14 | dart.core.List_interface setConstraints(dart.core.List_interface value); 15 | deltablue.Constraint_interface setDeterminedBy(deltablue.Constraint_interface value); 16 | int setMark(int value); 17 | deltablue.Strength_interface setWalkStrength(deltablue.Strength_interface value); 18 | boolean setStay(boolean value); 19 | int setValue(int value); 20 | 21 | } 22 | -------------------------------------------------------------------------------- /test/unit/let/scenario.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2016, the Dart project authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | int countForMultiUpdate() { 16 | int counter = 0; 17 | int i = 0; 18 | int j = 0; 19 | for (; i < 10; i++, j--) { 20 | counter = counter + i - j; 21 | } 22 | return counter; 23 | } 24 | 25 | int ternarySideEffectTest() { 26 | int a = 10; 27 | int b = 30; 28 | int c = a == 10 ? a++ : b--; 29 | return a + b + c; 30 | } -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | Contributor License Agreement 2 | ----------------------------- 3 | 4 | Contributions to any Google project must be accompanied by a Contributor 5 | License Agreement. This is not a copyright _assignment_; it simply gives 6 | Google permission to use and redistribute your contributions as part of the 7 | project. 8 | 9 | - If you are an individual writing original source code and you're sure you 10 | own the intellectual property, then you'll need to sign an [individual 11 | CLA][]. Please include your GitHub username. 12 | - If you work for a company that wants to allow you to contribute your work, 13 | then you'll need to sign a [corporate CLA][]. 14 | 15 | You generally only need to submit a CLA once, so if you've already submitted 16 | one (even if it was for a different project), you probably don't need to do it 17 | again. 18 | 19 | [individual CLA]: https://cla.developers.google.com/about/google-individual 20 | [corporate CLA]: https://developers.google.com/open-source/cla/corporate 21 | -------------------------------------------------------------------------------- /test/unit/java_class/Tests.java: -------------------------------------------------------------------------------- 1 | // Copyright 2016, the Dart project authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import static org.junit.Assert.assertEquals; 16 | import static org.junit.Assert.assertTrue; 17 | import static org.junit.Assert.assertFalse; 18 | 19 | import org.junit.Test; 20 | import scenario.__TopLevel; 21 | 22 | public class Tests { 23 | @Test 24 | public void testHashMap() { 25 | assertTrue(__TopLevel.testCase()); 26 | } 27 | } -------------------------------------------------------------------------------- /test/testing.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2016, the Dart project authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import 'dart:mirrors'; 16 | import 'package:path/path.dart' as path; 17 | 18 | final String testDirectory = 19 | path.dirname((reflectClass(_TestUtils).owner as LibraryMirror).uri.path); 20 | 21 | /// The local path to the root directory of the dart2java repo. 22 | final String repoDirectory = path.dirname(testDirectory); 23 | 24 | class _TestUtils {} 25 | -------------------------------------------------------------------------------- /test/unit/arguments/Tests.java: -------------------------------------------------------------------------------- 1 | // Copyright 2016, the Dart project authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import static org.junit.Assert.assertEquals; 16 | 17 | import org.junit.Test; 18 | import scenario.__TopLevel; 19 | 20 | public class Tests { 21 | @Test 22 | public void testOptionalArgs() { 23 | assertEquals(321, (int) __TopLevel.callFuncWithoutOptionalArg()); 24 | assertEquals(421, (int) __TopLevel.callFuncWithOptionalArg()); 25 | } 26 | } -------------------------------------------------------------------------------- /test/unit/map/Tests.java: -------------------------------------------------------------------------------- 1 | // Copyright 2016, the Dart project authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import static org.junit.Assert.assertEquals; 16 | import static org.junit.Assert.assertTrue; 17 | import static org.junit.Assert.assertFalse; 18 | 19 | import org.junit.Test; 20 | import scenario.__TopLevel; 21 | 22 | public class Tests { 23 | @Test 24 | public void testMapMethods() { 25 | assertEquals(200, (int) __TopLevel.readWriteMap()); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /test/codegen/classes.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2016, the Dart project authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | class Base {} 16 | // class Der1 extends Base {} -- Not yet supported, since 17 | // supertype uses type parameters 18 | // class Der2 extends Base> {} -- Not yet supported, 19 | // since supertype uses type parameters 20 | class Der3 extends Base> {} 21 | 22 | void main() {} 23 | -------------------------------------------------------------------------------- /tool/input_sdk/patch/internal_patch.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2016, the Dart project authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | library dart._internal; 16 | 17 | // These parts are in tool/input_sdk/internal/, but they are copied by the 18 | // patch_sdk.sh script into the gen/patched_sdk/lib/internal/ directory, so the 19 | // part declarations refer to them as if they are in the same directory as this 20 | // file. 21 | part 'java_annotations.dart'; 22 | part 'dart_map.dart'; 23 | -------------------------------------------------------------------------------- /test/unit/dart_class/Tests.java: -------------------------------------------------------------------------------- 1 | // Copyright 2016, the Dart project authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import static org.junit.Assert.assertEquals; 16 | import static org.junit.Assert.assertTrue; 17 | import static org.junit.Assert.assertFalse; 18 | 19 | import org.junit.Test; 20 | import scenario.__TopLevel; 21 | 22 | public class Tests { 23 | @Test 24 | public void testSuperMethodInvocation() { 25 | assertEquals(114, (int) __TopLevel.callClass3Bar()); 26 | } 27 | } -------------------------------------------------------------------------------- /tool/sdk_impl/java/dart/_runtime/types/simple/TypeExpr.java: -------------------------------------------------------------------------------- 1 | // Copyright 2016, the Dart project authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package dart._runtime.types.simple; 16 | 17 | /** 18 | * A type expression that can be evaluated to a {@link Type} relative to a {@link TypeEnvironment}. 19 | */ 20 | public abstract class TypeExpr { 21 | final String key; 22 | 23 | TypeExpr(String key) { 24 | this.key = key; 25 | } 26 | 27 | abstract Type evaluateUncached(TypeEnvironment env); 28 | } 29 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Dart2Java dev compiler 2 | ========================= 3 | 4 | The Dart2Java dev compiler is a transpiler from Dart to Java source. It is based 5 | on [DDC](https://github.com/dart-lang/dev_compiler) and [Kernel 6 | IR](https://github.com/dart-lang/kernel), and its main goal is to investigate 7 | which features of the Dart language make it particularly hard or easy for AOT 8 | compilation to a new language. Ideally, Dart2Java will enable interoperability 9 | between Dart and Java programs, and automatic translation of Dart programs to 10 | Java source. 11 | 12 | # Compiling the SDK 13 | 14 | The easy way to build the SDK is to run the `tool/build_sdk.sh` script. 15 | 16 | The script executes the following steps: 17 | 18 | * Patch the SDK: `tool/patch_sdk.sh` 19 | * Compile the SDK: `dart2java --dart-sdk=gen/patched_sdk --output=gen/compiled_sdk --package-prefix=dart dart:_internal ...` 20 | * Compile the generated `.java` files with `javac` 21 | * Archive the generated `.class` files with `jar` 22 | 23 | # Disclaimer 24 | 25 | This is not an official Google product. 26 | -------------------------------------------------------------------------------- /test/codegen_expect/is_operator_test/I.java: -------------------------------------------------------------------------------- 1 | package is_operator_test; 2 | 3 | public abstract class I extends dart._runtime.base.DartObject implements is_operator_test.I_interface 4 | { 5 | public static dart._runtime.types.simple.InterfaceTypeInfo dart2java$typeInfo = new dart._runtime.types.simple.InterfaceTypeInfo(is_operator_test.I.class, is_operator_test.I_interface.class); 6 | private static dart._runtime.types.simple.InterfaceTypeExpr dart2java$typeExpr_Object = new dart._runtime.types.simple.InterfaceTypeExpr(dart._runtime.helpers.ObjectHelper.dart2java$typeInfo); 7 | static { 8 | is_operator_test.I.dart2java$typeInfo.superclass = dart2java$typeExpr_Object; 9 | } 10 | 11 | public I(dart._runtime.helpers.ConstructorHelper.EmptyConstructorMarker arg, dart._runtime.types.simple.Type type) 12 | { 13 | super(arg, type); 14 | } 15 | 16 | public void _constructor() 17 | { 18 | final dart._runtime.types.simple.TypeEnvironment dart2java$localTypeEnv = this.dart2java$type.env; 19 | super._constructor(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /test/codegen_expect/generics/Bar2_interface__generic_int.java: -------------------------------------------------------------------------------- 1 | package generics; 2 | 3 | public interface Bar2_interface__generic_int extends dart._runtime.base.DartObject_interface, generics.Bar2_interface 4 | { 5 | A bar_Bar2__generic_int(A a, int b); 6 | A getVarA_Bar2__generic_int(); 7 | int getVarB_Bar2__generic_int(); 8 | A setVarA_Bar2__generic_int(A value); 9 | int setVarB_Bar2__generic_int(int value); 10 | default public A getVarA_Bar2() 11 | { 12 | return this.getVarA_Bar2__generic_int(); 13 | } 14 | default public java.lang.Integer getVarB_Bar2() 15 | { 16 | return this.getVarB_Bar2__generic_int(); 17 | } 18 | default public A setVarA_Bar2(A value) 19 | { 20 | return this.setVarA_Bar2__generic_int(((A) value)); 21 | } 22 | default public java.lang.Integer setVarB_Bar2(java.lang.Integer value) 23 | { 24 | return this.setVarB_Bar2__generic_int(((int) value)); 25 | } 26 | default public A bar_Bar2(A a, java.lang.Integer b) 27 | { 28 | return this.bar_Bar2__generic_int(((A) a), ((int) b)); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /test/unit/basic/Tests.java: -------------------------------------------------------------------------------- 1 | // Copyright 2016, the Dart project authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import static org.junit.Assert.assertEquals; 16 | 17 | import org.junit.Test; 18 | import scenario.__TopLevel; 19 | 20 | public class Tests { 21 | @Test 22 | public void testHelloWorld() { 23 | assertEquals("Hello World!", __TopLevel.helloWorld()); 24 | } 25 | 26 | @Test 27 | public void testMultiFieldAssignment() { 28 | assertEquals(12, (int) __TopLevel.setReturnMultipleFields(12)); 29 | } 30 | } -------------------------------------------------------------------------------- /tool/analyze.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright 2016, the Dart project authors. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | set -e 17 | 18 | # Switch to the root directory of dart2java. 19 | cd $( dirname "${BASH_SOURCE[0]}" )/.. 20 | 21 | function fail { 22 | echo -e "Analyzer found problems" 23 | return 1 24 | } 25 | 26 | echo "Running dartanalyzer to check for errors/warnings/hints..." 27 | dartanalyzer --strong --fatal-warnings --package-warnings bin/dart2java.dart \ 28 | | grep -v "\[info\] TODO" | (! grep $PWD) || fail 29 | -------------------------------------------------------------------------------- /test/unit/let/Tests.java: -------------------------------------------------------------------------------- 1 | // Copyright 2016, the Dart project authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import static org.junit.Assert.assertEquals; 16 | import static org.junit.Assert.assertTrue; 17 | import static org.junit.Assert.assertFalse; 18 | 19 | import org.junit.Test; 20 | import scenario.__TopLevel; 21 | 22 | public class Tests { 23 | @Test 24 | public void testLet() { 25 | assertEquals(90, (int) __TopLevel.countForMultiUpdate()); 26 | assertEquals(51, (int) __TopLevel.ternarySideEffectTest()); 27 | } 28 | } -------------------------------------------------------------------------------- /test/codegen_expect/generics/Bar2_interface__int_generic.java: -------------------------------------------------------------------------------- 1 | package generics; 2 | 3 | public interface Bar2_interface__int_generic extends dart._runtime.base.DartObject_interface, generics.Bar2_interface 4 | { 5 | int bar_Bar2__int_generic(int a, B b); 6 | int getVarA_Bar2__int_generic(); 7 | B getVarB_Bar2__int_generic(); 8 | int setVarA_Bar2__int_generic(int value); 9 | B setVarB_Bar2__int_generic(B value); 10 | default public java.lang.Integer getVarA_Bar2() 11 | { 12 | return this.getVarA_Bar2__int_generic(); 13 | } 14 | default public B getVarB_Bar2() 15 | { 16 | return this.getVarB_Bar2__int_generic(); 17 | } 18 | default public java.lang.Integer setVarA_Bar2(java.lang.Integer value) 19 | { 20 | return this.setVarA_Bar2__int_generic(((int) value)); 21 | } 22 | default public B setVarB_Bar2(B value) 23 | { 24 | return this.setVarB_Bar2__int_generic(((B) value)); 25 | } 26 | default public java.lang.Integer bar_Bar2(java.lang.Integer a, B b) 27 | { 28 | return this.bar_Bar2__int_generic(((int) a), ((B) b)); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /test/codegen_expect/richards/TaskControlBlock_interface.java: -------------------------------------------------------------------------------- 1 | package richards; 2 | 3 | public interface TaskControlBlock_interface extends dart._runtime.base.DartObject_interface 4 | { 5 | void setRunning(); 6 | void markAsNotHeld(); 7 | void markAsHeld(); 8 | boolean isHeldOrSuspended(); 9 | void markAsSuspended(); 10 | void markAsRunnable(); 11 | richards.TaskControlBlock_interface run(); 12 | richards.TaskControlBlock_interface checkPriorityAdd(richards.TaskControlBlock_interface task, richards.Packet_interface packet); 13 | java.lang.String toString(); 14 | richards.TaskControlBlock_interface getLink(); 15 | int getId(); 16 | int getPriority(); 17 | richards.Packet_interface getQueue(); 18 | richards.Task_interface getTask(); 19 | int getState(); 20 | richards.TaskControlBlock_interface setLink(richards.TaskControlBlock_interface value); 21 | int setId(int value); 22 | int setPriority(int value); 23 | richards.Packet_interface setQueue(richards.Packet_interface value); 24 | richards.Task_interface setTask(richards.Task_interface value); 25 | int setState(int value); 26 | 27 | } 28 | -------------------------------------------------------------------------------- /test/unit/dart_class/scenario.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2016, the Dart project authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | abstract class Class1 { 16 | int foo(); 17 | int bar() { 18 | return foo() + 1; 19 | } 20 | } 21 | 22 | class Class2 extends Class1 { 23 | int bar() { 24 | return super.bar() + 3; 25 | } 26 | 27 | int foo() { 28 | return 10; 29 | } 30 | } 31 | 32 | class Class3 extends Class2 { 33 | int foo() { 34 | return super.foo() + 100; 35 | } 36 | } 37 | 38 | int callClass3Bar() { 39 | return new Class3().bar(); 40 | } -------------------------------------------------------------------------------- /test/unit/dynamic/Tests.java: -------------------------------------------------------------------------------- 1 | // Copyright 2016, the Dart project authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import static org.junit.Assert.assertEquals; 16 | import static org.junit.Assert.assertTrue; 17 | import static org.junit.Assert.assertFalse; 18 | 19 | import org.junit.Test; 20 | import scenario.__TopLevel; 21 | 22 | public class Tests { 23 | @Test 24 | public void testDynamicDispatch() { 25 | assertEquals(530, (int) __TopLevel.testDynamicDispatch()); 26 | assertEquals(181, (int) __TopLevel.testDynamicDispatchPrimitive()); 27 | } 28 | } -------------------------------------------------------------------------------- /test/codegen_expect/generics/Bar2_interface__generic_double.java: -------------------------------------------------------------------------------- 1 | package generics; 2 | 3 | public interface Bar2_interface__generic_double extends dart._runtime.base.DartObject_interface, generics.Bar2_interface 4 | { 5 | A bar_Bar2__generic_double(A a, double b); 6 | A getVarA_Bar2__generic_double(); 7 | double getVarB_Bar2__generic_double(); 8 | A setVarA_Bar2__generic_double(A value); 9 | double setVarB_Bar2__generic_double(double value); 10 | default public A getVarA_Bar2() 11 | { 12 | return this.getVarA_Bar2__generic_double(); 13 | } 14 | default public java.lang.Double getVarB_Bar2() 15 | { 16 | return this.getVarB_Bar2__generic_double(); 17 | } 18 | default public A setVarA_Bar2(A value) 19 | { 20 | return this.setVarA_Bar2__generic_double(((A) value)); 21 | } 22 | default public java.lang.Double setVarB_Bar2(java.lang.Double value) 23 | { 24 | return this.setVarB_Bar2__generic_double(((double) value)); 25 | } 26 | default public A bar_Bar2(A a, java.lang.Double b) 27 | { 28 | return this.bar_Bar2__generic_double(((A) a), ((double) b)); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /test/codegen_expect/specialized_list/__TopLevel.java: -------------------------------------------------------------------------------- 1 | package specialized_list; 2 | 3 | public class __TopLevel 4 | { 5 | private static dart._runtime.types.simple.InterfaceTypeExpr dart2java$typeExpr_List$ltint$0$gt = new dart._runtime.types.simple.InterfaceTypeExpr(dart.core.List.dart2java$typeInfo, new dart._runtime.types.simple.TypeExpr[] {new dart._runtime.types.simple.InterfaceTypeExpr(dart._runtime.helpers.IntegerHelper.dart2java$typeInfo)}); 6 | 7 | 8 | 9 | public static void main(String[] args) 10 | { 11 | final dart._runtime.types.simple.TypeEnvironment dart2java$localTypeEnv = dart._runtime.types.simple.TypeEnvironment.ROOT; 12 | dart.core.__TopLevel.print("Expect output 5, 7, 9"); 13 | dart.core.List_interface__int intList = ((dart.core.List_interface__int) dart._runtime.base.DartList.specialfactory$fromArguments(dart2java$localTypeEnv.evaluate(dart2java$typeExpr_List$ltint$0$gt), 5, 7, 9)); 14 | for (int i = 0; (i < intList.getLength_List__int()); i = (i + 1)) 15 | { 16 | dart.core.__TopLevel.print(intList.operatorAt_List__int(i)); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /test/unit/interface/Tests.java: -------------------------------------------------------------------------------- 1 | // Copyright 2016, the Dart project authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import static org.junit.Assert.assertEquals; 16 | import static org.junit.Assert.assertTrue; 17 | import static org.junit.Assert.assertFalse; 18 | 19 | import org.junit.Test; 20 | import scenario.__TopLevel; 21 | 22 | public class Tests { 23 | @Test 24 | public void testInterfaces() { 25 | assertEquals(31, (int) __TopLevel.testA()); 26 | assertEquals(1213, (int) __TopLevel.testB()); 27 | assertEquals(1131, (int) __TopLevel.testC()); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /tool/input_sdk/lib/core/core.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2016, the Dart project authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | library dart.core; 16 | 17 | part 'bool.dart'; 18 | part 'comparable.dart'; 19 | part 'double.dart'; 20 | part 'function.dart'; 21 | part 'int.dart'; 22 | part 'iterable.dart'; 23 | part 'iterator.dart'; 24 | part 'list.dart'; 25 | part 'map.dart'; 26 | part 'null.dart'; 27 | part 'num.dart'; 28 | part 'object.dart'; 29 | part 'stopwatch.dart'; 30 | part 'string.dart'; 31 | part 'symbol.dart'; 32 | part 'type.dart'; 33 | 34 | external void print(Object o); 35 | -------------------------------------------------------------------------------- /test/unit/generic_class/Tests.java: -------------------------------------------------------------------------------- 1 | // Copyright 2016, the Dart project authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import org.junit.Test; 16 | import scenario.__TopLevel; 17 | 18 | import static org.junit.Assert.assertEquals; 19 | import static org.junit.Assert.assertTrue; 20 | import static org.junit.Assert.assertFalse; 21 | 22 | public class Tests { 23 | @Test 24 | public void testZero() { 25 | assertEquals(10, (int) __TopLevel.testZero()); 26 | } 27 | 28 | @Test 29 | public void testOne() { 30 | assertEquals(37, (int) __TopLevel.testOne()); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /test/unit/top_level/Tests.java: -------------------------------------------------------------------------------- 1 | // Copyright 2016, the Dart project authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import static org.junit.Assert.assertEquals; 16 | 17 | import org.junit.Test; 18 | import scenario.__TopLevel; 19 | 20 | public class Tests { 21 | @Test 22 | public void testTopLevelMembers() { 23 | assertEquals(5, (int) __TopLevel.method1()); 24 | assertEquals(10, (int) __TopLevel.getVar1()); 25 | assertEquals(10, (int) __TopLevel.callVar1Getter()); 26 | 27 | __TopLevel.setVar2(12); 28 | assertEquals(12, (int) __TopLevel.getVar2()); 29 | } 30 | } -------------------------------------------------------------------------------- /test/codegen_expect/generics/Bar2_interface__double_generic.java: -------------------------------------------------------------------------------- 1 | package generics; 2 | 3 | public interface Bar2_interface__double_generic extends dart._runtime.base.DartObject_interface, generics.Bar2_interface 4 | { 5 | double bar_Bar2__double_generic(double a, B b); 6 | double getVarA_Bar2__double_generic(); 7 | B getVarB_Bar2__double_generic(); 8 | double setVarA_Bar2__double_generic(double value); 9 | B setVarB_Bar2__double_generic(B value); 10 | default public java.lang.Double getVarA_Bar2() 11 | { 12 | return this.getVarA_Bar2__double_generic(); 13 | } 14 | default public B getVarB_Bar2() 15 | { 16 | return this.getVarB_Bar2__double_generic(); 17 | } 18 | default public java.lang.Double setVarA_Bar2(java.lang.Double value) 19 | { 20 | return this.setVarA_Bar2__double_generic(((double) value)); 21 | } 22 | default public B setVarB_Bar2(B value) 23 | { 24 | return this.setVarB_Bar2__double_generic(((B) value)); 25 | } 26 | default public java.lang.Double bar_Bar2(java.lang.Double a, B b) 27 | { 28 | return this.bar_Bar2__double_generic(((double) a), ((B) b)); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /test/unit/for_in/Tests.java: -------------------------------------------------------------------------------- 1 | // Copyright 2016, the Dart project authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import static org.junit.Assert.assertEquals; 16 | import static org.junit.Assert.assertTrue; 17 | import static org.junit.Assert.assertFalse; 18 | 19 | import org.junit.Test; 20 | import scenario.__TopLevel; 21 | 22 | public class Tests { 23 | @Test 24 | public void testForInInt() { 25 | assertEquals(10, (int) __TopLevel.testForInInt()); 26 | } 27 | 28 | @Test 29 | public void testForInStr() { 30 | assertEquals("1351", __TopLevel.testForInStr()); 31 | } 32 | } -------------------------------------------------------------------------------- /test/codegen_expect/generics/Bar2_interface__generic_boolean.java: -------------------------------------------------------------------------------- 1 | package generics; 2 | 3 | public interface Bar2_interface__generic_boolean extends dart._runtime.base.DartObject_interface, generics.Bar2_interface 4 | { 5 | A bar_Bar2__generic_boolean(A a, boolean b); 6 | A getVarA_Bar2__generic_boolean(); 7 | boolean getVarB_Bar2__generic_boolean(); 8 | A setVarA_Bar2__generic_boolean(A value); 9 | boolean setVarB_Bar2__generic_boolean(boolean value); 10 | default public A getVarA_Bar2() 11 | { 12 | return this.getVarA_Bar2__generic_boolean(); 13 | } 14 | default public java.lang.Boolean getVarB_Bar2() 15 | { 16 | return this.getVarB_Bar2__generic_boolean(); 17 | } 18 | default public A setVarA_Bar2(A value) 19 | { 20 | return this.setVarA_Bar2__generic_boolean(((A) value)); 21 | } 22 | default public java.lang.Boolean setVarB_Bar2(java.lang.Boolean value) 23 | { 24 | return this.setVarB_Bar2__generic_boolean(((boolean) value)); 25 | } 26 | default public A bar_Bar2(A a, java.lang.Boolean b) 27 | { 28 | return this.bar_Bar2__generic_boolean(((A) a), ((boolean) b)); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /test/codegen_expect/havlak/SimpleLoop_interface.java: -------------------------------------------------------------------------------- 1 | package havlak; 2 | 3 | public interface SimpleLoop_interface extends dart._runtime.base.DartObject_interface 4 | { 5 | boolean addNode(havlak.BasicBlock_interface bb); 6 | boolean addChildLoop(havlak.SimpleLoop_interface loop); 7 | void setParent_(havlak.SimpleLoop_interface p); 8 | void setHeader_(havlak.BasicBlock_interface bb); 9 | void setNestingLevel_(int level); 10 | int checksum(); 11 | dart.core.List_interface getBasicBlocks(); 12 | dart.core.List_interface getChildren(); 13 | int getCounter(); 14 | havlak.SimpleLoop_interface getParent(); 15 | havlak.BasicBlock_interface getHeader(); 16 | boolean getIsRoot(); 17 | boolean getIsReducible(); 18 | int getNestingLevel(); 19 | int getDepthLevel(); 20 | havlak.SimpleLoop_interface setParent(havlak.SimpleLoop_interface value); 21 | havlak.BasicBlock_interface setHeader(havlak.BasicBlock_interface value); 22 | boolean setIsRoot(boolean value); 23 | boolean setIsReducible(boolean value); 24 | int setNestingLevel(int value); 25 | int setDepthLevel(int value); 26 | 27 | } 28 | -------------------------------------------------------------------------------- /test/codegen_expect/generics/Bar2_interface__boolean_generic.java: -------------------------------------------------------------------------------- 1 | package generics; 2 | 3 | public interface Bar2_interface__boolean_generic extends dart._runtime.base.DartObject_interface, generics.Bar2_interface 4 | { 5 | boolean bar_Bar2__boolean_generic(boolean a, B b); 6 | boolean getVarA_Bar2__boolean_generic(); 7 | B getVarB_Bar2__boolean_generic(); 8 | boolean setVarA_Bar2__boolean_generic(boolean value); 9 | B setVarB_Bar2__boolean_generic(B value); 10 | default public java.lang.Boolean getVarA_Bar2() 11 | { 12 | return this.getVarA_Bar2__boolean_generic(); 13 | } 14 | default public B getVarB_Bar2() 15 | { 16 | return this.getVarB_Bar2__boolean_generic(); 17 | } 18 | default public java.lang.Boolean setVarA_Bar2(java.lang.Boolean value) 19 | { 20 | return this.setVarA_Bar2__boolean_generic(((boolean) value)); 21 | } 22 | default public B setVarB_Bar2(B value) 23 | { 24 | return this.setVarB_Bar2__boolean_generic(((B) value)); 25 | } 26 | default public java.lang.Boolean bar_Bar2(java.lang.Boolean a, B b) 27 | { 28 | return this.bar_Bar2__boolean_generic(((boolean) a), ((B) b)); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /test/unit/dart_class_generic/Tests.java: -------------------------------------------------------------------------------- 1 | // Copyright 2016, the Dart project authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import static org.junit.Assert.assertEquals; 16 | import static org.junit.Assert.assertTrue; 17 | import static org.junit.Assert.assertFalse; 18 | 19 | import org.junit.Test; 20 | import scenario.__TopLevel; 21 | 22 | public class Tests { 23 | @Test 24 | public void testSuperMethodInvocation() { 25 | assertEquals(114, (int) __TopLevel.callClass3Bar()); 26 | assertEquals(129, (int) __TopLevel.callClass6Bar()); 27 | assertEquals(114, (int) __TopLevel.callClass9Bar()); 28 | } 29 | } -------------------------------------------------------------------------------- /test/unit/generic_assignment/Tests.java: -------------------------------------------------------------------------------- 1 | // Copyright 2016, the Dart project authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import org.junit.Test; 16 | import scenario.__TopLevel; 17 | 18 | import static org.junit.Assert.assertEquals; 19 | import static org.junit.Assert.assertTrue; 20 | import static org.junit.Assert.assertFalse; 21 | 22 | public class Tests { 23 | @Test 24 | public void testAssignment() { 25 | assertTrue(__TopLevel.testAssignment()); 26 | } 27 | 28 | @Test(expected=RuntimeException.class) 29 | public void testFailedAssignment() { 30 | __TopLevel.testAssignmentFail(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /test/unit/generic_constructor/Tests.java: -------------------------------------------------------------------------------- 1 | // Copyright 2016, the Dart project authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import org.junit.Test; 16 | import scenario.__TopLevel; 17 | 18 | import static org.junit.Assert.assertEquals; 19 | import static org.junit.Assert.assertTrue; 20 | import static org.junit.Assert.assertFalse; 21 | 22 | public class Tests { 23 | @Test 24 | public void testSpecialized() { 25 | assertEquals(12, (int) __TopLevel.callConstructor()); 26 | assertEquals(13, (int) __TopLevel.callFirst()); 27 | assertEquals(14, (int) __TopLevel.callSecond()); 28 | assertEquals(15, (int) __TopLevel.callCallSecond()); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /test/unit/static/Tests.java: -------------------------------------------------------------------------------- 1 | // Copyright 2016, the Dart project authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import static org.junit.Assert.assertEquals; 16 | 17 | import org.junit.Test; 18 | import scenario.__TopLevel; 19 | 20 | public class Tests { 21 | @Test 22 | public void testStaticFieldAccess() { 23 | assertEquals(12, (int) __TopLevel.getVarViaStaticGet()); 24 | assertEquals(12, (int) __TopLevel.getVarViaStaticGetFromInst()); 25 | assertEquals(12, (int) __TopLevel.getVarViaStaticGetDirectly()); 26 | assertEquals(12, (int) __TopLevel.getVarViaStaticMethod()); 27 | assertEquals(12, (int) __TopLevel.getVarViaStaticMethodFromInst()); 28 | } 29 | } -------------------------------------------------------------------------------- /test/all_tests.dart: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env dart 2 | // Copyright 2016, the Dart project authors. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | /// Meta-test that runs all tests we have written. 17 | import 'package:test/test.dart'; 18 | 19 | import 'codegen_test.dart' as codegen_test; 20 | import 'multifile_codegen_test.dart' as multifile_codegen_test; 21 | import 'unit_test.dart' as unit_test; 22 | import 'typesystem_test.dart' as typesystem_test; 23 | 24 | void main(List argv) { 25 | group('codegen', () => codegen_test.main(argv)); 26 | group('codegen', () => multifile_codegen_test.main(argv)); 27 | group('unit', () => unit_test.main(argv)); 28 | group('typesystem', () => typesystem_test.main(argv)); 29 | } 30 | -------------------------------------------------------------------------------- /test/codegen_expect/is_operator_test/C.java: -------------------------------------------------------------------------------- 1 | package is_operator_test; 2 | 3 | public class C extends is_operator_test.A implements is_operator_test.C_interface 4 | { 5 | public static dart._runtime.types.simple.InterfaceTypeInfo dart2java$typeInfo = new dart._runtime.types.simple.InterfaceTypeInfo(is_operator_test.C.class, is_operator_test.C_interface.class); 6 | private static dart._runtime.types.simple.InterfaceTypeExpr dart2java$typeExpr_A = new dart._runtime.types.simple.InterfaceTypeExpr(is_operator_test.A.dart2java$typeInfo); 7 | static { 8 | is_operator_test.C.dart2java$typeInfo.superclass = dart2java$typeExpr_A; 9 | } 10 | 11 | public C(dart._runtime.helpers.ConstructorHelper.EmptyConstructorMarker arg, dart._runtime.types.simple.Type type) 12 | { 13 | super(arg, type); 14 | } 15 | 16 | public void _constructor() 17 | { 18 | final dart._runtime.types.simple.TypeEnvironment dart2java$localTypeEnv = this.dart2java$type.env; 19 | super._constructor(); 20 | } 21 | public static is_operator_test.C_interface _new_C$(dart._runtime.types.simple.Type type) 22 | { 23 | is_operator_test.C result; 24 | result = new is_operator_test.C(((dart._runtime.helpers.ConstructorHelper.EmptyConstructorMarker) null), type); 25 | result._constructor(); 26 | return result; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /test/unit/null/scenario.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2016, the Dart project authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | bool nullEqualsNull1() { 16 | return null == null; 17 | } 18 | 19 | bool nullEqualsNull2() { 20 | var val = null; 21 | return val == null; 22 | } 23 | 24 | bool nullEqualsNull3() { 25 | var val = null; 26 | return null == val; 27 | } 28 | 29 | class Class1 { } 30 | 31 | bool nullEqualsNull4() { 32 | Class1 val; 33 | return val == null; 34 | } 35 | 36 | bool nullEqualsNull5() { 37 | Class1 val; 38 | return null == val; 39 | } 40 | 41 | String nullToString1() { 42 | return null.toString(); 43 | } 44 | 45 | String nullToString2() { 46 | var val = null; 47 | return val.toString(); 48 | } 49 | 50 | String nullToString3() { 51 | Class1 val; 52 | return val.toString(); 53 | } 54 | -------------------------------------------------------------------------------- /test/codegen_expect/is_interfaces_test/B.java: -------------------------------------------------------------------------------- 1 | package is_interfaces_test; 2 | 3 | public class B extends is_interfaces_test.A implements is_interfaces_test.B_interface 4 | { 5 | public static dart._runtime.types.simple.InterfaceTypeInfo dart2java$typeInfo = new dart._runtime.types.simple.InterfaceTypeInfo(is_interfaces_test.B.class, is_interfaces_test.B_interface.class); 6 | private static dart._runtime.types.simple.InterfaceTypeExpr dart2java$typeExpr_A = new dart._runtime.types.simple.InterfaceTypeExpr(is_interfaces_test.A.dart2java$typeInfo); 7 | static { 8 | is_interfaces_test.B.dart2java$typeInfo.superclass = dart2java$typeExpr_A; 9 | } 10 | 11 | public B(dart._runtime.helpers.ConstructorHelper.EmptyConstructorMarker arg, dart._runtime.types.simple.Type type) 12 | { 13 | super(arg, type); 14 | } 15 | 16 | public void _constructor() 17 | { 18 | final dart._runtime.types.simple.TypeEnvironment dart2java$localTypeEnv = this.dart2java$type.env; 19 | super._constructor(); 20 | } 21 | public static is_interfaces_test.B_interface _new_B$(dart._runtime.types.simple.Type type) 22 | { 23 | is_interfaces_test.B result; 24 | result = new is_interfaces_test.B(((dart._runtime.helpers.ConstructorHelper.EmptyConstructorMarker) null), type); 25 | result._constructor(); 26 | return result; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: dart2java 2 | version: 0.2.0 3 | description: > 4 | Experimental Dart to Java compiler designed to create idiomatic, readable Java 5 | output. 6 | 7 | author: Dart Dev Compiler team 8 | homepage: https://github.com/dart-lang/dev_compiler 9 | 10 | dependencies: 11 | analyzer: ^0.28.0-alpha.1 12 | args: ^0.13.0 13 | bazel_worker: ^0.1.0 14 | cli_util: ^0.0.1 15 | func: ^0.1.0 16 | html: ^0.12.0 17 | js: ^0.6.0 18 | kernel: 19 | # This is an old modified version of Kernel 20 | # TODO(springerm): Use newer version of Kernel, it probably has everything 21 | # that we implemented in our version by now. 22 | git: 23 | url: ssh://git@github.com/google/dart2java.git 24 | ref: kernel 25 | path: ^1.3.0 26 | pub_semver: ^1.1.0 27 | source_maps: ^0.10.0 28 | source_span: ^1.0.2 29 | 30 | dependency_overrides: 31 | analyzer: ^0.28.0-alpha.1 32 | 33 | dev_dependencies: 34 | # We pin a specific version to ensure everyone is formatting the code exactly 35 | # the same way. This is because any change in dart_style, even non-breaking 36 | # changes, may change the output format. 37 | dart_style: 0.2.4 38 | test: ^0.12.0 39 | unittest: ^0.11.6 40 | webdriver: ^1.1.0 41 | 42 | environment: 43 | sdk: ">=1.12.0 <2.0.0" 44 | 45 | executables: 46 | dart2java: dart2java 47 | dumptree: dumptree 48 | -------------------------------------------------------------------------------- /test/unit/generic_extends/Tests.java: -------------------------------------------------------------------------------- 1 | // Copyright 2016, the Dart project authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import org.junit.Test; 16 | import scenario.__TopLevel; 17 | 18 | import static org.junit.Assert.assertEquals; 19 | import static org.junit.Assert.assertTrue; 20 | import static org.junit.Assert.assertFalse; 21 | 22 | public class Tests { 23 | @Test 24 | public void testGetterSetter() { 25 | assertEquals("5610", __TopLevel.testGetterSetter()); 26 | } 27 | 28 | @Test 29 | public void testExtends() { 30 | assertEquals(60, __TopLevel.testExtends()); 31 | } 32 | 33 | public void testMixtureGenericNonGeneric() { 34 | assertEquals(30890, (int) __TopLevel.testFoo()); 35 | assertEquals(30890, (int) __TopLevel.testFooSuperSpec()); 36 | assertEquals(360, (int) __TopLevel.testBaz()); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /test/unit/dynamic/scenario.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2016, the Dart project authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | class Class1 { 16 | int foo(int a, int b) { 17 | return a + b; 18 | } 19 | } 20 | 21 | class Class2 { 22 | int foo(int a, int b) { 23 | return a + b * 2; 24 | } 25 | } 26 | 27 | int testDynamicDispatch() { 28 | int result = 0; 29 | dynamic d = new Class1(); 30 | result = result + (d.foo(10, 20) as int); 31 | d = new Class2(); 32 | result = result + (d.foo(100, 200) as int); 33 | return result; 34 | } 35 | 36 | int testDynamicDispatchPrimitive() { 37 | int result = 0; 38 | dynamic v1 = 50; 39 | dynamic v2 = 100; 40 | result = result + (v1 + v2) as int; 41 | 42 | dynamic v3 = 10.5; 43 | dynamic v4 = 20.5; 44 | result = (result + (v3 + v4) as double).toInt(); 45 | 46 | return result; 47 | } 48 | -------------------------------------------------------------------------------- /test/unit/generic_constructor/scenario.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2016, the Dart project authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | class Foo { 16 | A a; 17 | B b; 18 | 19 | Foo(this.a, this.b); 20 | Foo.firstParam(this.a); 21 | Foo.secondParam(this.b); 22 | 23 | factory Foo.callSecond(B b) { 24 | Foo myFoo = new Foo.secondParam(b); 25 | return myFoo; 26 | } 27 | } 28 | 29 | int callConstructor() { 30 | var result = new Foo(12, true); 31 | return result.a; 32 | } 33 | 34 | int callFirst() { 35 | var result = new Foo.firstParam(13); 36 | return result.a; 37 | } 38 | 39 | int callSecond() { 40 | var result = new Foo.secondParam(14); 41 | return result.b; 42 | } 43 | 44 | int callCallSecond() { 45 | var result = new Foo.callSecond(15); 46 | return result.b; 47 | } -------------------------------------------------------------------------------- /test/codegen_expect/is_interfaces_test/A.java: -------------------------------------------------------------------------------- 1 | package is_interfaces_test; 2 | 3 | public class A extends dart._runtime.base.DartObject implements is_interfaces_test.A_interface 4 | { 5 | public static dart._runtime.types.simple.InterfaceTypeInfo dart2java$typeInfo = new dart._runtime.types.simple.InterfaceTypeInfo(is_interfaces_test.A.class, is_interfaces_test.A_interface.class); 6 | private static dart._runtime.types.simple.InterfaceTypeExpr dart2java$typeExpr_Object = new dart._runtime.types.simple.InterfaceTypeExpr(dart._runtime.helpers.ObjectHelper.dart2java$typeInfo); 7 | static { 8 | is_interfaces_test.A.dart2java$typeInfo.superclass = dart2java$typeExpr_Object; 9 | } 10 | 11 | public A(dart._runtime.helpers.ConstructorHelper.EmptyConstructorMarker arg, dart._runtime.types.simple.Type type) 12 | { 13 | super(arg, type); 14 | } 15 | 16 | public void _constructor() 17 | { 18 | final dart._runtime.types.simple.TypeEnvironment dart2java$localTypeEnv = this.dart2java$type.env; 19 | super._constructor(); 20 | } 21 | public static is_interfaces_test.A_interface _new_A$(dart._runtime.types.simple.Type type) 22 | { 23 | is_interfaces_test.A result; 24 | result = new is_interfaces_test.A(((dart._runtime.helpers.ConstructorHelper.EmptyConstructorMarker) null), type); 25 | result._constructor(); 26 | return result; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /tool/sdk_impl/java/dart/_runtime/helpers/ObjectHelper.java: -------------------------------------------------------------------------------- 1 | // Copyright 2016, the Dart project authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package dart._runtime.helpers; 16 | 17 | import dart._runtime.types.simple.InterfaceTypeInfo; 18 | 19 | public class ObjectHelper { 20 | public static final InterfaceTypeInfo dart2java$typeInfo 21 | = new InterfaceTypeInfo(Object.class, null); 22 | 23 | public static int getHashCode(Object self) { 24 | // Hash code of null in Dart VM is 2011 ;) 25 | return self == null ? 2011 : self.hashCode(); 26 | } 27 | 28 | public static boolean operatorEqual(Object self, Object other) { 29 | return self == null ? other == null : self.equals(other); 30 | } 31 | 32 | public static String toString(Object self) { 33 | return self == null ? "null" : self.toString(); 34 | } 35 | 36 | } 37 | 38 | -------------------------------------------------------------------------------- /test/codegen_expect/is_operator_test/AI.java: -------------------------------------------------------------------------------- 1 | package is_operator_test; 2 | 3 | public abstract class AI extends dart._runtime.base.DartObject implements is_operator_test.AI_interface, is_operator_test.I_interface 4 | { 5 | public static dart._runtime.types.simple.InterfaceTypeInfo dart2java$typeInfo = new dart._runtime.types.simple.InterfaceTypeInfo(is_operator_test.AI.class, is_operator_test.AI_interface.class); 6 | private static dart._runtime.types.simple.InterfaceTypeExpr dart2java$typeExpr_Object = new dart._runtime.types.simple.InterfaceTypeExpr(dart._runtime.helpers.ObjectHelper.dart2java$typeInfo); 7 | private static dart._runtime.types.simple.InterfaceTypeExpr dart2java$typeExpr_I = new dart._runtime.types.simple.InterfaceTypeExpr(is_operator_test.I.dart2java$typeInfo); 8 | static { 9 | is_operator_test.AI.dart2java$typeInfo.superclass = dart2java$typeExpr_Object; 10 | is_operator_test.AI.dart2java$typeInfo.interfaces = new dart._runtime.types.simple.InterfaceTypeExpr[] {dart2java$typeExpr_I}; 11 | } 12 | 13 | public AI(dart._runtime.helpers.ConstructorHelper.EmptyConstructorMarker arg, dart._runtime.types.simple.Type type) 14 | { 15 | super(arg, type); 16 | } 17 | 18 | public void _constructor() 19 | { 20 | final dart._runtime.types.simple.TypeEnvironment dart2java$localTypeEnv = this.dart2java$type.env; 21 | super._constructor(); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /tool/format.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright 2016, the Dart project authors. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | # Switch to the root directory of dev_compiler 17 | cd $( dirname "${BASH_SOURCE[0]}" )/.. 18 | 19 | # Run formatter in rewrite mode on all files that are part of the project. 20 | # This checks that all files are committed first to git, so no state is lost. 21 | # The formatter ignores: 22 | # * local files that have never been added to git, 23 | # * subdirectories of test/ and tool/, unless explicitly added. Those dirs 24 | # contain a lot of generated or external source we should not reformat. 25 | files="$(git ls-files 'bin/*.dart' 'lib/*.dart')" 26 | [[ -n "$(git status -s $files)" ]] \ 27 | && { echo "Did not run the formatter, please commit edited files first."; exit 1; } \ 28 | || { echo "Running dart formatter" ; pub run dart_style:format -w $files; } 29 | -------------------------------------------------------------------------------- /test/codegen_expect/interface_type_profile/A0.java: -------------------------------------------------------------------------------- 1 | package interface_type_profile; 2 | 3 | public class A0 extends dart._runtime.base.DartObject implements interface_type_profile.A0_interface 4 | { 5 | public static dart._runtime.types.simple.InterfaceTypeInfo dart2java$typeInfo = new dart._runtime.types.simple.InterfaceTypeInfo(interface_type_profile.A0.class, interface_type_profile.A0_interface.class); 6 | private static dart._runtime.types.simple.InterfaceTypeExpr dart2java$typeExpr_Object = new dart._runtime.types.simple.InterfaceTypeExpr(dart._runtime.helpers.ObjectHelper.dart2java$typeInfo); 7 | static { 8 | interface_type_profile.A0.dart2java$typeInfo.superclass = dart2java$typeExpr_Object; 9 | } 10 | 11 | public A0(dart._runtime.helpers.ConstructorHelper.EmptyConstructorMarker arg, dart._runtime.types.simple.Type type) 12 | { 13 | super(arg, type); 14 | } 15 | 16 | public void _constructor() 17 | { 18 | final dart._runtime.types.simple.TypeEnvironment dart2java$localTypeEnv = this.dart2java$type.env; 19 | super._constructor(); 20 | } 21 | public static interface_type_profile.A0_interface _new_A0$(dart._runtime.types.simple.Type type) 22 | { 23 | interface_type_profile.A0 result; 24 | result = new interface_type_profile.A0(((dart._runtime.helpers.ConstructorHelper.EmptyConstructorMarker) null), type); 25 | result._constructor(); 26 | return result; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /test/codegen_expect/interface_type_profile/A1.java: -------------------------------------------------------------------------------- 1 | package interface_type_profile; 2 | 3 | public class A1 extends dart._runtime.base.DartObject implements interface_type_profile.A1_interface 4 | { 5 | public static dart._runtime.types.simple.InterfaceTypeInfo dart2java$typeInfo = new dart._runtime.types.simple.InterfaceTypeInfo(interface_type_profile.A1.class, interface_type_profile.A1_interface.class); 6 | private static dart._runtime.types.simple.InterfaceTypeExpr dart2java$typeExpr_Object = new dart._runtime.types.simple.InterfaceTypeExpr(dart._runtime.helpers.ObjectHelper.dart2java$typeInfo); 7 | static { 8 | interface_type_profile.A1.dart2java$typeInfo.superclass = dart2java$typeExpr_Object; 9 | } 10 | 11 | public A1(dart._runtime.helpers.ConstructorHelper.EmptyConstructorMarker arg, dart._runtime.types.simple.Type type) 12 | { 13 | super(arg, type); 14 | } 15 | 16 | public void _constructor() 17 | { 18 | final dart._runtime.types.simple.TypeEnvironment dart2java$localTypeEnv = this.dart2java$type.env; 19 | super._constructor(); 20 | } 21 | public static interface_type_profile.A1_interface _new_A1$(dart._runtime.types.simple.Type type) 22 | { 23 | interface_type_profile.A1 result; 24 | result = new interface_type_profile.A1(((dart._runtime.helpers.ConstructorHelper.EmptyConstructorMarker) null), type); 25 | result._constructor(); 26 | return result; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /test/codegen_expect/interface_type_profile/A2.java: -------------------------------------------------------------------------------- 1 | package interface_type_profile; 2 | 3 | public class A2 extends dart._runtime.base.DartObject implements interface_type_profile.A2_interface 4 | { 5 | public static dart._runtime.types.simple.InterfaceTypeInfo dart2java$typeInfo = new dart._runtime.types.simple.InterfaceTypeInfo(interface_type_profile.A2.class, interface_type_profile.A2_interface.class); 6 | private static dart._runtime.types.simple.InterfaceTypeExpr dart2java$typeExpr_Object = new dart._runtime.types.simple.InterfaceTypeExpr(dart._runtime.helpers.ObjectHelper.dart2java$typeInfo); 7 | static { 8 | interface_type_profile.A2.dart2java$typeInfo.superclass = dart2java$typeExpr_Object; 9 | } 10 | 11 | public A2(dart._runtime.helpers.ConstructorHelper.EmptyConstructorMarker arg, dart._runtime.types.simple.Type type) 12 | { 13 | super(arg, type); 14 | } 15 | 16 | public void _constructor() 17 | { 18 | final dart._runtime.types.simple.TypeEnvironment dart2java$localTypeEnv = this.dart2java$type.env; 19 | super._constructor(); 20 | } 21 | public static interface_type_profile.A2_interface _new_A2$(dart._runtime.types.simple.Type type) 22 | { 23 | interface_type_profile.A2 result; 24 | result = new interface_type_profile.A2(((dart._runtime.helpers.ConstructorHelper.EmptyConstructorMarker) null), type); 25 | result._constructor(); 26 | return result; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /test/codegen_expect/interface_type_profile/A3.java: -------------------------------------------------------------------------------- 1 | package interface_type_profile; 2 | 3 | public class A3 extends dart._runtime.base.DartObject implements interface_type_profile.A3_interface 4 | { 5 | public static dart._runtime.types.simple.InterfaceTypeInfo dart2java$typeInfo = new dart._runtime.types.simple.InterfaceTypeInfo(interface_type_profile.A3.class, interface_type_profile.A3_interface.class); 6 | private static dart._runtime.types.simple.InterfaceTypeExpr dart2java$typeExpr_Object = new dart._runtime.types.simple.InterfaceTypeExpr(dart._runtime.helpers.ObjectHelper.dart2java$typeInfo); 7 | static { 8 | interface_type_profile.A3.dart2java$typeInfo.superclass = dart2java$typeExpr_Object; 9 | } 10 | 11 | public A3(dart._runtime.helpers.ConstructorHelper.EmptyConstructorMarker arg, dart._runtime.types.simple.Type type) 12 | { 13 | super(arg, type); 14 | } 15 | 16 | public void _constructor() 17 | { 18 | final dart._runtime.types.simple.TypeEnvironment dart2java$localTypeEnv = this.dart2java$type.env; 19 | super._constructor(); 20 | } 21 | public static interface_type_profile.A3_interface _new_A3$(dart._runtime.types.simple.Type type) 22 | { 23 | interface_type_profile.A3 result; 24 | result = new interface_type_profile.A3(((dart._runtime.helpers.ConstructorHelper.EmptyConstructorMarker) null), type); 25 | result._constructor(); 26 | return result; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /test/codegen_expect/interface_type_profile/B0.java: -------------------------------------------------------------------------------- 1 | package interface_type_profile; 2 | 3 | public class B0 extends dart._runtime.base.DartObject implements interface_type_profile.B0_interface 4 | { 5 | public static dart._runtime.types.simple.InterfaceTypeInfo dart2java$typeInfo = new dart._runtime.types.simple.InterfaceTypeInfo(interface_type_profile.B0.class, interface_type_profile.B0_interface.class); 6 | private static dart._runtime.types.simple.InterfaceTypeExpr dart2java$typeExpr_Object = new dart._runtime.types.simple.InterfaceTypeExpr(dart._runtime.helpers.ObjectHelper.dart2java$typeInfo); 7 | static { 8 | interface_type_profile.B0.dart2java$typeInfo.superclass = dart2java$typeExpr_Object; 9 | } 10 | 11 | public B0(dart._runtime.helpers.ConstructorHelper.EmptyConstructorMarker arg, dart._runtime.types.simple.Type type) 12 | { 13 | super(arg, type); 14 | } 15 | 16 | public void _constructor() 17 | { 18 | final dart._runtime.types.simple.TypeEnvironment dart2java$localTypeEnv = this.dart2java$type.env; 19 | super._constructor(); 20 | } 21 | public static interface_type_profile.B0_interface _new_B0$(dart._runtime.types.simple.Type type) 22 | { 23 | interface_type_profile.B0 result; 24 | result = new interface_type_profile.B0(((dart._runtime.helpers.ConstructorHelper.EmptyConstructorMarker) null), type); 25 | result._constructor(); 26 | return result; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /test/unit/null/Tests.java: -------------------------------------------------------------------------------- 1 | // Copyright 2016, the Dart project authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import static org.junit.Assert.assertEquals; 16 | import static org.junit.Assert.assertTrue; 17 | import static org.junit.Assert.assertFalse; 18 | 19 | import org.junit.Test; 20 | import scenario.__TopLevel; 21 | 22 | public class Tests { 23 | @Test 24 | public void testNullEquals() { 25 | assertTrue(__TopLevel.nullEqualsNull1()); 26 | assertTrue(__TopLevel.nullEqualsNull2()); 27 | assertTrue(__TopLevel.nullEqualsNull3()); 28 | assertTrue(__TopLevel.nullEqualsNull4()); 29 | assertTrue(__TopLevel.nullEqualsNull5()); 30 | } 31 | 32 | @Test 33 | public void testNullToString() { 34 | assertEquals("null", __TopLevel.nullToString1()); 35 | assertEquals("null", __TopLevel.nullToString2()); 36 | assertEquals("null", __TopLevel.nullToString3()); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /test/unit/java_class/scenario.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2016, the Dart project authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import 'dart:_internal'; 16 | 17 | @JavaClass("java.util.HashMap") 18 | class JavaHashMap { 19 | external static HashMap(); 20 | 21 | @JavaMethod("get") 22 | external Object at(Object key); 23 | 24 | external Object put(Object key, Object value); 25 | } 26 | 27 | class VariableHolder { 28 | static JavaHashMap javaMap = new JavaHashMap(); 29 | 30 | static void setValue(Object key, Object value) { 31 | javaMap.put(key, value); 32 | } 33 | 34 | static Object getValue(Object key) { 35 | return javaMap.at(key); 36 | } 37 | } 38 | 39 | bool testCase() { 40 | // TODO(springerm): Make this work for types other than Object 41 | var key = new Object(); 42 | var value = new Object(); 43 | 44 | VariableHolder.setValue(key, value); 45 | return VariableHolder.getValue(key) == value; 46 | } -------------------------------------------------------------------------------- /test/unit/generics/Tests.java: -------------------------------------------------------------------------------- 1 | // Copyright 2016, the Dart project authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import static org.junit.Assert.assertEquals; 16 | import static org.junit.Assert.assertTrue; 17 | import static org.junit.Assert.assertFalse; 18 | 19 | import org.junit.Test; 20 | import scenario.__TopLevel; 21 | 22 | public class Tests { 23 | @Test 24 | public void testCovariance() { 25 | assertEquals(72, (int) __TopLevel.testSubclassSubtype()); 26 | } 27 | 28 | @Test 29 | public void testSubtype() { 30 | assertEquals(36, (int) __TopLevel.testTypeSubtypeInList()); 31 | } 32 | 33 | @Test 34 | public void testSpecialization() { 35 | // Cannot test if the correct specialization was chosen, 36 | // have to look at the generated code! 37 | assertEquals(60, (int) __TopLevel.testSingleTypeArgumentSpecialization()); 38 | assertEquals("102030", __TopLevel.testAssignmentOfSpecialization()); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /test/unit/generic_extends_type_check/Tests.java: -------------------------------------------------------------------------------- 1 | // Copyright 2016, the Dart project authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import org.junit.Test; 16 | import scenario.__TopLevel; 17 | 18 | import static org.junit.Assert.assertEquals; 19 | import static org.junit.Assert.assertTrue; 20 | import static org.junit.Assert.assertFalse; 21 | 22 | public class Tests { 23 | @Test(expected=ClassCastException.class) 24 | public void testInvocationFail() { 25 | __TopLevel.testInvocationFail(); 26 | __TopLevel.testInvocationFail_Generic(); 27 | } 28 | 29 | @Test 30 | public void testInvocationOK2() { 31 | assertEquals("Hello World", __TopLevel.testInvocationOK2()); 32 | assertEquals("Hello World", __TopLevel.testInvocationOK2_Generic()); 33 | } 34 | 35 | @Test 36 | public void testInvocationOK1() { 37 | assertEquals("Hello World", __TopLevel.testInvocationOK1()); 38 | assertEquals("Hello World", __TopLevel.testInvocationOK1_Generic()); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /test/unit/generic_assignment/scenario.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2016, the Dart project authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | 16 | class A { } 17 | class B extends A { } 18 | 19 | class Bar { } 20 | 21 | bool testAssignment() { 22 | Bar oo = new Bar(); 23 | Bar oi = new Bar(); 24 | Bar oa = new Bar(); 25 | Bar ob = new Bar(); 26 | 27 | oo = oo; 28 | oo = oi; 29 | oo = oa; 30 | oo = ob; 31 | 32 | Bar ai = new Bar(); 33 | Bar bi = new Bar(); 34 | Bar ii = new Bar(); 35 | 36 | oo = ai; 37 | oo = bi; 38 | oo = ii; 39 | oi = ai; 40 | oi = bi; 41 | oi = ii; 42 | ai = bi; 43 | 44 | oo = ai; 45 | ai = oo; 46 | 47 | oo = ii; 48 | 49 | return true; 50 | } 51 | 52 | bool testAssignmentFail() { 53 | Bar oo = new Bar(); 54 | Bar ai = oo; 55 | return true; 56 | } -------------------------------------------------------------------------------- /test/codegen_expect/richards/Task.java: -------------------------------------------------------------------------------- 1 | package richards; 2 | 3 | public abstract class Task extends dart._runtime.base.DartObject implements richards.Task_interface 4 | { 5 | public static dart._runtime.types.simple.InterfaceTypeInfo dart2java$typeInfo = new dart._runtime.types.simple.InterfaceTypeInfo(richards.Task.class, richards.Task_interface.class); 6 | private static dart._runtime.types.simple.InterfaceTypeExpr dart2java$typeExpr_Object = new dart._runtime.types.simple.InterfaceTypeExpr(dart._runtime.helpers.ObjectHelper.dart2java$typeInfo); 7 | static { 8 | richards.Task.dart2java$typeInfo.superclass = dart2java$typeExpr_Object; 9 | } 10 | public richards.Scheduler_interface scheduler; 11 | 12 | public Task(dart._runtime.helpers.ConstructorHelper.EmptyConstructorMarker arg, dart._runtime.types.simple.Type type) 13 | { 14 | super(arg, type); 15 | } 16 | 17 | public abstract richards.TaskControlBlock_interface run(richards.Packet_interface packet); 18 | public void _constructor(richards.Scheduler_interface scheduler) 19 | { 20 | final dart._runtime.types.simple.TypeEnvironment dart2java$localTypeEnv = this.dart2java$type.env; 21 | this.scheduler = scheduler; 22 | super._constructor(); 23 | } 24 | public richards.Scheduler_interface getScheduler() 25 | { 26 | return this.scheduler; 27 | } 28 | public richards.Scheduler_interface setScheduler(richards.Scheduler_interface value) 29 | { 30 | this.scheduler = value; 31 | return value; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /tool/input_sdk/internal/dart_map.dart: -------------------------------------------------------------------------------- 1 | part of dart._internal; 2 | 3 | class LinkedHashMap implements Map { 4 | List _keys = new List(); 5 | List _values = new List(); 6 | 7 | LinkedHashMap(); 8 | 9 | factory LinkedHashMap.newInstance() { 10 | return new LinkedHashMap(); 11 | } 12 | 13 | bool containsValue(Object value) { 14 | return _values.contains(value); 15 | } 16 | 17 | bool containsKey(Object key) { 18 | return _keys.contains(key); 19 | } 20 | 21 | V operator [](Object key) { 22 | for (int i = 0; i < _keys.length; i++) { 23 | if (_keys[i] == key) { 24 | return _values[i]; 25 | } 26 | } 27 | 28 | throw "Key not found"; 29 | } 30 | 31 | void operator []=(K key, V value) { 32 | for (int i = 0; i < _keys.length; i++) { 33 | if (_keys[i] == key) { 34 | _values[i] = value; 35 | return; 36 | } 37 | } 38 | 39 | _keys.add(key); 40 | _values.add(value); 41 | } 42 | 43 | V remove(Object key) { 44 | for (int i = 0; i < _keys.length; i++) { 45 | if (_keys[i] == key) { 46 | _keys.removeAt(i); 47 | return _values.removeAt(i); 48 | } 49 | } 50 | 51 | throw "Key not found"; 52 | } 53 | 54 | void clear() { 55 | _keys.clear(); 56 | _values.clear(); 57 | } 58 | 59 | int get length => _keys.length; 60 | 61 | bool get isEmpty => _keys.isEmpty; 62 | 63 | bool get isNotEmpty => _keys.isNotEmpty; 64 | 65 | Iterable get keys => _keys; 66 | 67 | Iterable get values => _values; 68 | } -------------------------------------------------------------------------------- /test/unit/interface/scenario.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2016, the Dart project authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | class A { 16 | int foo() { 17 | return 1; 18 | } 19 | 20 | int bar(int a, int b) { 21 | return a + b; 22 | } 23 | } 24 | 25 | class B implements A { 26 | int foo() { 27 | return 2; 28 | } 29 | 30 | int bar(int a, int b) { 31 | return a + b * 10; 32 | } 33 | 34 | int qux(int c) { 35 | return c + 1; 36 | } 37 | } 38 | 39 | class C extends A implements B { 40 | int qux(int c) { 41 | return c + 100; 42 | } 43 | } 44 | 45 | int testA() { 46 | var a = new A(); 47 | return a.foo() + a.bar(10, 20); // expect 31 48 | } 49 | 50 | int testB() { 51 | A b1 = new B(); 52 | B b2 = new B(); 53 | int result = b1.foo() + b1.bar(10, 20) + b2.qux(1000); // expect 1213 54 | return result; 55 | } 56 | 57 | int testC() { 58 | A c1 = new C(); 59 | B c2 = new C(); 60 | int result = c1.foo() + c1.bar(10, 20) + c2.qux(1000); // expect 1131 61 | return result; 62 | } 63 | -------------------------------------------------------------------------------- /third_party/hamcrest-1.3/LICENSE: -------------------------------------------------------------------------------- 1 | BSD License 2 | 3 | Copyright (c) 2000-2006, www.hamcrest.org 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | Redistributions of source code must retain the above copyright notice, this list of 10 | conditions and the following disclaimer. Redistributions in binary form must reproduce 11 | the above copyright notice, this list of conditions and the following disclaimer in 12 | the documentation and/or other materials provided with the distribution. 13 | 14 | Neither the name of Hamcrest nor the names of its contributors may be used to endorse 15 | or promote products derived from this software without specific prior written 16 | permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 19 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 20 | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 21 | SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 22 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 23 | TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 24 | BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY 26 | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 27 | DAMAGE. 28 | -------------------------------------------------------------------------------- /test/codegen_expect/generics/Foo1_interface__int.java: -------------------------------------------------------------------------------- 1 | package generics; 2 | 3 | public interface Foo1_interface__int extends dart._runtime.base.DartObject_interface, generics.Foo1_interface 4 | { 5 | void createInnerFoo_Foo1__int(); 6 | int foo_Foo1__int(int t); 7 | void writeVariable_Foo1__int(int value); 8 | int getVariable_Foo1__int(); 9 | generics.Foo1_interface__int getAnotherFoo1_Foo1__int(); 10 | int setVariable_Foo1__int(int value); 11 | generics.Foo1_interface__int setAnotherFoo1_Foo1__int(generics.Foo1_interface__int value); 12 | default public java.lang.Integer getVariable_Foo1() 13 | { 14 | return this.getVariable_Foo1__int(); 15 | } 16 | default public generics.Foo1_interface getAnotherFoo1_Foo1() 17 | { 18 | return this.getAnotherFoo1_Foo1__int(); 19 | } 20 | default public java.lang.Integer setVariable_Foo1(java.lang.Integer value) 21 | { 22 | return this.setVariable_Foo1__int(((int) value)); 23 | } 24 | default public generics.Foo1_interface setAnotherFoo1_Foo1(generics.Foo1_interface value) 25 | { 26 | return this.setAnotherFoo1_Foo1__int(((generics.Foo1_interface__int) value)); 27 | } 28 | default public void createInnerFoo_Foo1() 29 | { 30 | this.createInnerFoo_Foo1__int(); 31 | } 32 | default public java.lang.Integer foo_Foo1(java.lang.Integer t) 33 | { 34 | return this.foo_Foo1__int(((int) t)); 35 | } 36 | default public void writeVariable_Foo1(java.lang.Integer value) 37 | { 38 | this.writeVariable_Foo1__int(((int) value)); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /third_party/daftspaniel/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014, Davy Mitchell 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without modification, 5 | are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, this 11 | list of conditions and the following disclaimer in the documentation and/or 12 | other materials provided with the distribution. 13 | 14 | * Neither the name of the {organization} nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 22 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 25 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /test/codegen_expect/tracer/Engine_interface.java: -------------------------------------------------------------------------------- 1 | package tracer; 2 | 3 | public interface Engine_interface extends dart._runtime.base.DartObject_interface 4 | { 5 | void setPixel(int x, int y, tracer.Color_interface color); 6 | void renderScene(tracer.Scene_interface scene, java.lang.Object canvas); 7 | tracer.Color_interface getPixelColor(tracer.Ray_interface ray, tracer.Scene_interface scene); 8 | tracer.IntersectionInfo_interface testIntersection(tracer.Ray_interface ray, tracer.Scene_interface scene, tracer.BaseShape_interface exclude); 9 | tracer.Ray_interface getReflectionRay(tracer.Vector_interface P, tracer.Vector_interface N, tracer.Vector_interface V); 10 | tracer.Color_interface rayTrace(tracer.IntersectionInfo_interface info, tracer.Ray_interface ray, tracer.Scene_interface scene, int depth); 11 | java.lang.String toString(); 12 | int getCanvasWidth(); 13 | int getCanvasHeight(); 14 | int getPixelWidth(); 15 | int getPixelHeight(); 16 | boolean getRenderDiffuse(); 17 | boolean getRenderShadows(); 18 | boolean getRenderHighlights(); 19 | boolean getRenderReflections(); 20 | int getRayDepth(); 21 | java.lang.Object getCanvas(); 22 | int setCanvasWidth(int value); 23 | int setCanvasHeight(int value); 24 | int setPixelWidth(int value); 25 | int setPixelHeight(int value); 26 | boolean setRenderDiffuse(boolean value); 27 | boolean setRenderShadows(boolean value); 28 | boolean setRenderHighlights(boolean value); 29 | boolean setRenderReflections(boolean value); 30 | int setRayDepth(int value); 31 | java.lang.Object setCanvas(java.lang.Object value); 32 | 33 | } 34 | -------------------------------------------------------------------------------- /test/unit/dart_object/scenario.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2016, the Dart project authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | bool equalObjectObject() { 16 | return new Object() == new Object(); 17 | } 18 | 19 | bool equalObjectInt() { 20 | return new Object() == 123; 21 | } 22 | 23 | bool equalIntObject() { 24 | return 123 == new Object(); 25 | } 26 | 27 | bool equalIntInt() { 28 | return 123 == 123; 29 | } 30 | 31 | String toStringObject() { 32 | return new Object().toString(); 33 | } 34 | 35 | String toStringInteger() { 36 | return 12.toString(); 37 | } 38 | 39 | class Class1 { 40 | 41 | } 42 | 43 | bool equalObjectClass1() { 44 | return new Object() == new Class1(); 45 | } 46 | 47 | bool equalClass1Object() { 48 | return new Class1() == new Object(); 49 | } 50 | 51 | bool equalClass1Class1() { 52 | return new Class1() == new Class1(); 53 | } 54 | 55 | void hashCodeObject() { 56 | new Object().hashCode; 57 | } 58 | 59 | void hashCodeClass1() { 60 | new Class1().hashCode; 61 | } 62 | 63 | void hashCodeInteger() { 64 | 12.hashCode; 65 | } 66 | -------------------------------------------------------------------------------- /test/unit/static/scenario.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2016, the Dart project authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | class Class1 { 16 | static int x = 12; 17 | 18 | static int callStaticGet() { 19 | return x; 20 | } 21 | 22 | static int getGetVarX() { 23 | return callStaticGet(); 24 | } 25 | 26 | int instGetVarX() { 27 | return callStaticGet(); 28 | } 29 | 30 | int callStaticGetFromInst() { 31 | return x; 32 | } 33 | } 34 | 35 | int getVarViaStaticGet() { 36 | // StaticGet from static method 37 | return Class1.callStaticGet(); 38 | } 39 | 40 | int getVarViaStaticGetFromInst() { 41 | // StaticGet from instance method 42 | return new Class1().callStaticGetFromInst(); 43 | } 44 | 45 | int getVarViaStaticGetDirectly() { 46 | return Class1.x; 47 | } 48 | 49 | int getVarViaStaticMethod() { 50 | // Call static method from static method 51 | return Class1.getGetVarX(); 52 | } 53 | 54 | int getVarViaStaticMethodFromInst() { 55 | // Call static method from instance method 56 | return new Class1().instGetVarX(); 57 | } 58 | -------------------------------------------------------------------------------- /tool/build_sdk.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright 2016, the Dart project authors. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | set -e 17 | 18 | DART_SDK_LIBS="dart:_internal dart:core dart:async dart:math" 19 | 20 | # Switch to the root directory of dart2java. 21 | cd $( dirname "${BASH_SOURCE[0]}" )/.. 22 | 23 | rm -rf gen/compiled_sdk 24 | mkdir -p gen/compiled_sdk 25 | 26 | tool/patch_sdk.sh 27 | 28 | # Clean the gen directory 29 | rm -rf gen/compiled_sdk 30 | 31 | # Compile SDK implementation 32 | dart -c bin/dart2java.dart \ 33 | --dart-sdk=gen/patched_sdk \ 34 | --output-dir=gen/compiled_sdk \ 35 | $DART_SDK_LIBS 36 | 37 | # Copy helpers to gen directory 38 | cp -R tool/sdk_impl/java/dart gen/compiled_sdk 39 | 40 | # Remove any `packages` symlinks created by pub 41 | find gen/compiled_sdk -name "packages" -delete 42 | 43 | # Compile all Java SDK files 44 | find gen/compiled_sdk -name "*.java" -print0 | xargs -0 javac 45 | 46 | # Generate the jar file 47 | jar cf gen/compiled_sdk.jar -C gen/compiled_sdk dart 48 | 49 | echo "Generated compiled SDK: gen/compiled_sdk.jar" 50 | -------------------------------------------------------------------------------- /tool/sdk_impl/java/dart/_runtime/types/simple/package-info.java: -------------------------------------------------------------------------------- 1 | // Copyright 2016, the Dart project authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /** 16 | * Simple implementation of Dart type system. 17 | *

18 | * This implementation attempts to focus on correctness first, without worrying much about 19 | * performance characteristics. Many results are cached, but we do not attempt to tune the caches. 20 | * The type data (such as class supertype declarations) are stored in straightforward formats, from 21 | * which it is obvious how to compute subtype results. However, there are no attempts made to 22 | * optimize these computations. The intention is to later add one or more alternate packages, such 23 | * as (say) {@code dart._runtime.types.optimized}, that are profiled, more performant, and 24 | * API-compatible with this package. Once an optimized replacement is implemented and tested, 25 | * switching to it should be as easy as changing the {@code import} declarations in generated Java 26 | * source files. 27 | */ 28 | package dart._runtime.types.simple; 29 | -------------------------------------------------------------------------------- /test/unit/constructor/Tests.java: -------------------------------------------------------------------------------- 1 | // Copyright 2016, the Dart project authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import static org.junit.Assert.assertEquals; 16 | 17 | import org.junit.Test; 18 | import scenario.__TopLevel; 19 | 20 | public class Tests { 21 | @Test 22 | public void testBasicConstructors() { 23 | assertEquals(12, (int) __TopLevel.createClass1()); 24 | assertEquals(5, (int) __TopLevel.createClass2()); 25 | } 26 | 27 | @Test 28 | public void testInitializers() { 29 | assertEquals(5, (int) __TopLevel.createClass3()); 30 | assertEquals(4, (int) __TopLevel.createClass4()); 31 | } 32 | 33 | @Test 34 | public void testIntializerOrder() { 35 | assertEquals(101, (int) __TopLevel.createClass6()); 36 | 37 | __TopLevel.createB(); 38 | String[] initOrderExpected = new String[] {"fieldB2", "fieldB1", 39 | "fieldA3", "fieldA2", "fieldA1", "bodyA", "bodyB"}; 40 | String[] initOrder = ((java.util.List)__TopLevel.initOrder).toArray(new String[] {}); 41 | assertEquals(initOrderExpected, initOrder); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /test/unit/control_flow/Tests.java: -------------------------------------------------------------------------------- 1 | // Copyright 2016, the Dart project authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import static org.junit.Assert.assertEquals; 16 | import static org.junit.Assert.assertTrue; 17 | import static org.junit.Assert.assertFalse; 18 | 19 | import org.junit.Test; 20 | import scenario.__TopLevel; 21 | 22 | public class Tests { 23 | 24 | @Test 25 | public void testIfStatement() { 26 | assertTrue(__TopLevel.isLessIfThen(1, 2)); 27 | assertFalse(__TopLevel.isLessIfThen(2, 1)); 28 | assertTrue(__TopLevel.isLessIfThenElse(1, 2)); 29 | assertFalse(__TopLevel.isLessIfThenElse(2, 1)); 30 | } 31 | 32 | @Test 33 | public void testTernary() { 34 | assertTrue(__TopLevel.isLessTernary(1, 2)); 35 | assertFalse(__TopLevel.isLessTernary(2, 1)); 36 | } 37 | 38 | @Test 39 | public void testLoops() { 40 | assertEquals(10, (int) __TopLevel.countWhile()); 41 | assertEquals(10, (int) __TopLevel.countDo()); 42 | assertEquals(10, (int) __TopLevel.countFor()); 43 | assertEquals(90, (int) __TopLevel.countForMultiUpdate()); 44 | } 45 | } -------------------------------------------------------------------------------- /test/codegen_expect/gameoflife/GameOfLife.java: -------------------------------------------------------------------------------- 1 | package gameoflife; 2 | 3 | public class GameOfLife extends gameoflife.BenchmarkBase implements gameoflife.GameOfLife_interface 4 | { 5 | public static dart._runtime.types.simple.InterfaceTypeInfo dart2java$typeInfo = new dart._runtime.types.simple.InterfaceTypeInfo(gameoflife.GameOfLife.class, gameoflife.GameOfLife_interface.class); 6 | private static dart._runtime.types.simple.InterfaceTypeExpr dart2java$typeExpr_BenchmarkBase = new dart._runtime.types.simple.InterfaceTypeExpr(gameoflife.BenchmarkBase.dart2java$typeInfo); 7 | static { 8 | gameoflife.GameOfLife.dart2java$typeInfo.superclass = dart2java$typeExpr_BenchmarkBase; 9 | } 10 | 11 | public GameOfLife(dart._runtime.helpers.ConstructorHelper.EmptyConstructorMarker arg, dart._runtime.types.simple.Type type) 12 | { 13 | super(arg, type); 14 | } 15 | 16 | public void run() 17 | { 18 | final dart._runtime.types.simple.TypeEnvironment dart2java$localTypeEnv = this.dart2java$type.env; 19 | gameoflife.__TopLevel.gameOfLife(); 20 | } 21 | public void _constructor() 22 | { 23 | final dart._runtime.types.simple.TypeEnvironment dart2java$localTypeEnv = this.dart2java$type.env; 24 | super._constructor("GameOfLife"); 25 | } 26 | public static gameoflife.GameOfLife_interface _new_GameOfLife$(dart._runtime.types.simple.Type type) 27 | { 28 | gameoflife.GameOfLife result; 29 | result = new gameoflife.GameOfLife(((dart._runtime.helpers.ConstructorHelper.EmptyConstructorMarker) null), type); 30 | result._constructor(); 31 | return result; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /test/unit/control_flow/scenario.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2016, the Dart project authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | bool isLessIfThen(int a, int b) { 16 | if (a < b) { 17 | return true; 18 | } 19 | 20 | return false; 21 | } 22 | 23 | bool isLessIfThenElse(int a, int b) { 24 | if (a < b) { 25 | return true; 26 | } else { 27 | return false; 28 | } 29 | } 30 | 31 | bool isLessTernary(int a, int b) { 32 | return a < b ? true : false; 33 | } 34 | 35 | int countWhile() { 36 | int i = 0; 37 | while (i < 10) { 38 | i = i + 1; 39 | } 40 | return i; 41 | } 42 | 43 | int countDo() { 44 | int i = 0; 45 | do { 46 | i = i + 1; 47 | } while (i < 10); 48 | return i; 49 | } 50 | 51 | 52 | int countFor() { 53 | int counter = 0; 54 | for (var i = 0; i < 10; i = i + 1) { 55 | counter = counter + 1; 56 | } 57 | return counter; 58 | } 59 | 60 | int countForMultiUpdate() { 61 | int counter = 0; 62 | int i = 0; 63 | int j = 0; 64 | for (; i < 10; i = i + 1, j = j - 1) { 65 | counter = counter + i - j; 66 | } 67 | return counter; 68 | } 69 | -------------------------------------------------------------------------------- /test/codegen_expect/generics/Foo1_interface__double.java: -------------------------------------------------------------------------------- 1 | package generics; 2 | 3 | public interface Foo1_interface__double extends dart._runtime.base.DartObject_interface, generics.Foo1_interface 4 | { 5 | void createInnerFoo_Foo1__double(); 6 | double foo_Foo1__double(double t); 7 | void writeVariable_Foo1__double(double value); 8 | double getVariable_Foo1__double(); 9 | generics.Foo1_interface__double getAnotherFoo1_Foo1__double(); 10 | double setVariable_Foo1__double(double value); 11 | generics.Foo1_interface__double setAnotherFoo1_Foo1__double(generics.Foo1_interface__double value); 12 | default public java.lang.Double getVariable_Foo1() 13 | { 14 | return this.getVariable_Foo1__double(); 15 | } 16 | default public generics.Foo1_interface getAnotherFoo1_Foo1() 17 | { 18 | return this.getAnotherFoo1_Foo1__double(); 19 | } 20 | default public java.lang.Double setVariable_Foo1(java.lang.Double value) 21 | { 22 | return this.setVariable_Foo1__double(((double) value)); 23 | } 24 | default public generics.Foo1_interface setAnotherFoo1_Foo1(generics.Foo1_interface value) 25 | { 26 | return this.setAnotherFoo1_Foo1__double(((generics.Foo1_interface__double) value)); 27 | } 28 | default public void createInnerFoo_Foo1() 29 | { 30 | this.createInnerFoo_Foo1__double(); 31 | } 32 | default public java.lang.Double foo_Foo1(java.lang.Double t) 33 | { 34 | return this.foo_Foo1__double(((double) t)); 35 | } 36 | default public void writeVariable_Foo1(java.lang.Double value) 37 | { 38 | this.writeVariable_Foo1__double(((double) value)); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /test/codegen_expect/deltablue/DeltaBlue.java: -------------------------------------------------------------------------------- 1 | package deltablue; 2 | 3 | public class DeltaBlue extends deltablue.BenchmarkBase implements deltablue.DeltaBlue_interface 4 | { 5 | public static dart._runtime.types.simple.InterfaceTypeInfo dart2java$typeInfo = new dart._runtime.types.simple.InterfaceTypeInfo(deltablue.DeltaBlue.class, deltablue.DeltaBlue_interface.class); 6 | private static dart._runtime.types.simple.InterfaceTypeExpr dart2java$typeExpr_BenchmarkBase = new dart._runtime.types.simple.InterfaceTypeExpr(deltablue.BenchmarkBase.dart2java$typeInfo); 7 | static { 8 | deltablue.DeltaBlue.dart2java$typeInfo.superclass = dart2java$typeExpr_BenchmarkBase; 9 | } 10 | 11 | public DeltaBlue(dart._runtime.helpers.ConstructorHelper.EmptyConstructorMarker arg, dart._runtime.types.simple.Type type) 12 | { 13 | super(arg, type); 14 | } 15 | 16 | public void run() 17 | { 18 | final dart._runtime.types.simple.TypeEnvironment dart2java$localTypeEnv = this.dart2java$type.env; 19 | deltablue.__TopLevel.chainTest(100); 20 | deltablue.__TopLevel.projectionTest(100); 21 | } 22 | public void _constructor() 23 | { 24 | final dart._runtime.types.simple.TypeEnvironment dart2java$localTypeEnv = this.dart2java$type.env; 25 | super._constructor("DeltaBlue"); 26 | } 27 | public static deltablue.DeltaBlue_interface _new_DeltaBlue$(dart._runtime.types.simple.Type type) 28 | { 29 | deltablue.DeltaBlue result; 30 | result = new deltablue.DeltaBlue(((dart._runtime.helpers.ConstructorHelper.EmptyConstructorMarker) null), type); 31 | result._constructor(); 32 | return result; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /test/codegen_expect/richards/Scheduler_interface.java: -------------------------------------------------------------------------------- 1 | package richards; 2 | 3 | public interface Scheduler_interface extends dart._runtime.base.DartObject_interface 4 | { 5 | void addIdleTask(int id, int priority, richards.Packet_interface queue, int count); 6 | void addWorkerTask(int id, int priority, richards.Packet_interface queue); 7 | void addHandlerTask(int id, int priority, richards.Packet_interface queue); 8 | void addDeviceTask(int id, int priority, richards.Packet_interface queue); 9 | void addRunningTask(int id, int priority, richards.Packet_interface queue, richards.Task_interface task); 10 | void addTask(int id, int priority, richards.Packet_interface queue, richards.Task_interface task); 11 | void schedule(); 12 | richards.TaskControlBlock_interface release(int id); 13 | richards.TaskControlBlock_interface holdCurrent(); 14 | richards.TaskControlBlock_interface suspendCurrent(); 15 | richards.TaskControlBlock_interface queue(richards.Packet_interface packet); 16 | int getQueueCount(); 17 | int getHoldCount(); 18 | richards.TaskControlBlock_interface getCurrentTcb(); 19 | int getCurrentId(); 20 | richards.TaskControlBlock_interface getList(); 21 | dart.core.List_interface getBlocks(); 22 | int setQueueCount(int value); 23 | int setHoldCount(int value); 24 | richards.TaskControlBlock_interface setCurrentTcb(richards.TaskControlBlock_interface value); 25 | int setCurrentId(int value); 26 | richards.TaskControlBlock_interface setList(richards.TaskControlBlock_interface value); 27 | dart.core.List_interface setBlocks(dart.core.List_interface value); 28 | 29 | } 30 | -------------------------------------------------------------------------------- /test/codegen_expect/generics/Foo1_interface__boolean.java: -------------------------------------------------------------------------------- 1 | package generics; 2 | 3 | public interface Foo1_interface__boolean extends dart._runtime.base.DartObject_interface, generics.Foo1_interface 4 | { 5 | void createInnerFoo_Foo1__boolean(); 6 | boolean foo_Foo1__boolean(boolean t); 7 | void writeVariable_Foo1__boolean(boolean value); 8 | boolean getVariable_Foo1__boolean(); 9 | generics.Foo1_interface__boolean getAnotherFoo1_Foo1__boolean(); 10 | boolean setVariable_Foo1__boolean(boolean value); 11 | generics.Foo1_interface__boolean setAnotherFoo1_Foo1__boolean(generics.Foo1_interface__boolean value); 12 | default public java.lang.Boolean getVariable_Foo1() 13 | { 14 | return this.getVariable_Foo1__boolean(); 15 | } 16 | default public generics.Foo1_interface getAnotherFoo1_Foo1() 17 | { 18 | return this.getAnotherFoo1_Foo1__boolean(); 19 | } 20 | default public java.lang.Boolean setVariable_Foo1(java.lang.Boolean value) 21 | { 22 | return this.setVariable_Foo1__boolean(((boolean) value)); 23 | } 24 | default public generics.Foo1_interface setAnotherFoo1_Foo1(generics.Foo1_interface value) 25 | { 26 | return this.setAnotherFoo1_Foo1__boolean(((generics.Foo1_interface__boolean) value)); 27 | } 28 | default public void createInnerFoo_Foo1() 29 | { 30 | this.createInnerFoo_Foo1__boolean(); 31 | } 32 | default public java.lang.Boolean foo_Foo1(java.lang.Boolean t) 33 | { 34 | return this.foo_Foo1__boolean(((boolean) t)); 35 | } 36 | default public void writeVariable_Foo1(java.lang.Boolean value) 37 | { 38 | this.writeVariable_Foo1__boolean(((boolean) value)); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /test/codegen_expect/is_operator_test/B.java: -------------------------------------------------------------------------------- 1 | package is_operator_test; 2 | 3 | public class B extends dart._runtime.base.DartObject implements is_operator_test.B_interface, is_operator_test.I_interface 4 | { 5 | public static dart._runtime.types.simple.InterfaceTypeInfo dart2java$typeInfo = new dart._runtime.types.simple.InterfaceTypeInfo(is_operator_test.B.class, is_operator_test.B_interface.class); 6 | private static dart._runtime.types.simple.InterfaceTypeExpr dart2java$typeExpr_Object = new dart._runtime.types.simple.InterfaceTypeExpr(dart._runtime.helpers.ObjectHelper.dart2java$typeInfo); 7 | private static dart._runtime.types.simple.InterfaceTypeExpr dart2java$typeExpr_I = new dart._runtime.types.simple.InterfaceTypeExpr(is_operator_test.I.dart2java$typeInfo); 8 | static { 9 | is_operator_test.B.dart2java$typeInfo.superclass = dart2java$typeExpr_Object; 10 | is_operator_test.B.dart2java$typeInfo.interfaces = new dart._runtime.types.simple.InterfaceTypeExpr[] {dart2java$typeExpr_I}; 11 | } 12 | 13 | public B(dart._runtime.helpers.ConstructorHelper.EmptyConstructorMarker arg, dart._runtime.types.simple.Type type) 14 | { 15 | super(arg, type); 16 | } 17 | 18 | public void _constructor() 19 | { 20 | final dart._runtime.types.simple.TypeEnvironment dart2java$localTypeEnv = this.dart2java$type.env; 21 | super._constructor(); 22 | } 23 | public static is_operator_test.B_interface _new_B$(dart._runtime.types.simple.Type type) 24 | { 25 | is_operator_test.B result; 26 | result = new is_operator_test.B(((dart._runtime.helpers.ConstructorHelper.EmptyConstructorMarker) null), type); 27 | result._constructor(); 28 | return result; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /tool/input_sdk/internal/java_annotations.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2016, the Dart project authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | part of dart._internal; 16 | 17 | /// Annonated methods should be declared as "external" and be implemented in 18 | /// Java. This is useful for functionality that cannot be implemented in Dart 19 | /// or should be implemented in Java for performance reasons. 20 | class JavaCall { 21 | /// The full name of the static Java method. 22 | final String name; 23 | 24 | const JavaCall(this.name); 25 | } 26 | 27 | /// Annotated (external) methods have a different Java name. E.g., a Dart 28 | /// method cannot have the name `get`, but a Java method can. In that case, 29 | /// an `@JavaMethod` annotation should be added to a Dart method with a 30 | /// different name. 31 | class JavaMethod { 32 | /// The name of the Java method. 33 | final String name; 34 | 35 | const JavaMethod(this.name); 36 | } 37 | 38 | /// Annotated classes serve as Dart interfaces only and are implemented by 39 | /// Java classes. 40 | class JavaClass { 41 | /// The full name of the Java class. 42 | final String name; 43 | 44 | const JavaClass(this.name); 45 | } 46 | --------------------------------------------------------------------------------