Verify that the AOT mojo does not fail when generating JDK8 lambda code
authorJaroslav Tulach <jaroslav.tulach@apidesign.org>
Sun, 14 Sep 2014 21:40:03 +0200
changeset 1694615bae775606
parent 1693 800cb3d9f3b0
child 1695 e92259cb930a
Verify that the AOT mojo does not fail when generating JDK8 lambda code
rt/mojo/src/main/java/org/apidesign/bck2brwsr/mojo/AheadOfTime.java
rt/vm8/pom.xml
rt/vm8/src/main/java/org/apidesign/bck2brwsr/vm8/Defaults.java
rt/vm8/src/main/java/org/apidesign/bck2brwsr/vm8/Lambdas.java
rt/vm8/src/test/java/org/apidesign/bck2brwsr/vm8/Defaults.java
rt/vm8/src/test/java/org/apidesign/bck2brwsr/vm8/Lambdas.java
     1.1 --- a/rt/mojo/src/main/java/org/apidesign/bck2brwsr/mojo/AheadOfTime.java	Sun Sep 14 21:36:56 2014 +0200
     1.2 +++ b/rt/mojo/src/main/java/org/apidesign/bck2brwsr/mojo/AheadOfTime.java	Sun Sep 14 21:40:03 2014 +0200
     1.3 @@ -130,7 +130,6 @@
     1.4                  FileWriter w = new FileWriter(mainJavaScript);
     1.5                  c.
     1.6                          obfuscation(obfuscation).
     1.7 -                        resources(loader).
     1.8                          generate(w);
     1.9                  w.close();
    1.10              }
     2.1 --- a/rt/vm8/pom.xml	Sun Sep 14 21:36:56 2014 +0200
     2.2 +++ b/rt/vm8/pom.xml	Sun Sep 14 21:40:03 2014 +0200
     2.3 @@ -32,6 +32,21 @@
     2.4                      </systemProperties>
     2.5                  </configuration>
     2.6              </plugin>
     2.7 +            <plugin>
     2.8 +                <groupId>org.apidesign.bck2brwsr</groupId>
     2.9 +                <artifactId>bck2brwsr-maven-plugin</artifactId>
    2.10 +                <version>${project.version}</version>
    2.11 +                <executions>
    2.12 +                    <execution>
    2.13 +                        <goals>
    2.14 +                            <goal>aot</goal>
    2.15 +                        </goals>
    2.16 +                        <phase>verify</phase>
    2.17 +                    </execution>
    2.18 +                </executions>
    2.19 +                <configuration>
    2.20 +                </configuration>
    2.21 +            </plugin>
    2.22          </plugins>
    2.23      </build>
    2.24      <dependencies>
    2.25 @@ -58,7 +73,13 @@
    2.26              <groupId>${project.groupId}</groupId>
    2.27              <artifactId>emul</artifactId>
    2.28              <version>${project.version}</version>
    2.29 -            <scope>test</scope>
    2.30 +            <scope>compile</scope>
    2.31 +        </dependency>
    2.32 +        <dependency>
    2.33 +            <groupId>org.apidesign.bck2brwsr</groupId>
    2.34 +            <artifactId>emul.mini</artifactId>
    2.35 +            <version>${project.version}</version>
    2.36 +            <scope>compile</scope>
    2.37          </dependency>
    2.38          <dependency>
    2.39              <groupId>org.apidesign.bck2brwsr</groupId>
    2.40 @@ -72,6 +93,12 @@
    2.41              <artifactId>launcher.http</artifactId>
    2.42              <version>${project.version}</version>
    2.43              <scope>test</scope>
    2.44 +            <exclusions>
    2.45 +                <exclusion>
    2.46 +                    <groupId>com.oracle</groupId>
    2.47 +                    <artifactId>javafx</artifactId>
    2.48 +                </exclusion>
    2.49 +            </exclusions>
    2.50          </dependency>
    2.51      </dependencies>
    2.52  </project>
    2.53 \ No newline at end of file
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/rt/vm8/src/main/java/org/apidesign/bck2brwsr/vm8/Defaults.java	Sun Sep 14 21:40:03 2014 +0200
     3.3 @@ -0,0 +1,65 @@
     3.4 +/**
     3.5 + * Back 2 Browser Bytecode Translator
     3.6 + * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
     3.7 + *
     3.8 + * This program is free software: you can redistribute it and/or modify
     3.9 + * it under the terms of the GNU General Public License as published by
    3.10 + * the Free Software Foundation, version 2 of the License.
    3.11 + *
    3.12 + * This program is distributed in the hope that it will be useful,
    3.13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    3.14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3.15 + * GNU General Public License for more details.
    3.16 + *
    3.17 + * You should have received a copy of the GNU General Public License
    3.18 + * along with this program. Look for COPYING file in the top folder.
    3.19 + * If not, see http://opensource.org/licenses/GPL-2.0.
    3.20 + */
    3.21 +package org.apidesign.bck2brwsr.vm8;
    3.22 +
    3.23 +public interface Defaults {
    3.24 +    public static int staticValue() {
    3.25 +        return 42;
    3.26 +    }
    3.27 +    
    3.28 +    public default int value() {
    3.29 +        return 42;
    3.30 +    }
    3.31 +    
    3.32 +    public static Defaults create(int type) {
    3.33 +        class X implements Defaults {
    3.34 +        }
    3.35 +        class Y implements Defaults {
    3.36 +            @Override
    3.37 +            public int value() {
    3.38 +                return 7;
    3.39 +            }
    3.40 +        }
    3.41 +        class Z implements DoubleDefaults {
    3.42 +        }
    3.43 +        switch (type) {
    3.44 +            case 0: return new X();
    3.45 +            case 1: return new Y();
    3.46 +            default: return new Z();
    3.47 +        }
    3.48 +    }
    3.49 +    
    3.50 +    public static int defaultValue() {
    3.51 +        return create(0).value();
    3.52 +    }
    3.53 +    
    3.54 +    public static int myValue() {
    3.55 +        return create(1).value();
    3.56 +    }
    3.57 +
    3.58 +    public static int sndValue() {
    3.59 +        return create(2).value();
    3.60 +    }
    3.61 +    
    3.62 +    public interface DoubleDefaults extends Defaults {
    3.63 +        @Override
    3.64 +        public default int value() {
    3.65 +            return 84;
    3.66 +        }
    3.67 +    }
    3.68 +}
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/rt/vm8/src/main/java/org/apidesign/bck2brwsr/vm8/Lambdas.java	Sun Sep 14 21:40:03 2014 +0200
     4.3 @@ -0,0 +1,36 @@
     4.4 +/**
     4.5 + * Back 2 Browser Bytecode Translator
     4.6 + * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
     4.7 + *
     4.8 + * This program is free software: you can redistribute it and/or modify
     4.9 + * it under the terms of the GNU General Public License as published by
    4.10 + * the Free Software Foundation, version 2 of the License.
    4.11 + *
    4.12 + * This program is distributed in the hope that it will be useful,
    4.13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    4.14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4.15 + * GNU General Public License for more details.
    4.16 + *
    4.17 + * You should have received a copy of the GNU General Public License
    4.18 + * along with this program. Look for COPYING file in the top folder.
    4.19 + * If not, see http://opensource.org/licenses/GPL-2.0.
    4.20 + */
    4.21 +package org.apidesign.bck2brwsr.vm8;
    4.22 +
    4.23 +/**
    4.24 + *
    4.25 + * @author Jaroslav Tulach
    4.26 + */
    4.27 +public class Lambdas {
    4.28 +    private static void fewTimes(Runnable r, int cnt) {
    4.29 +        while (cnt-- > 0) {
    4.30 +            r.run();
    4.31 +        }
    4.32 +    }
    4.33 +    
    4.34 +    public static String compound() {
    4.35 +        StringBuilder sb = new StringBuilder();
    4.36 +        fewTimes(() -> sb.append('X'), 10);
    4.37 +        return sb.toString();
    4.38 +    }
    4.39 +}
     5.1 --- a/rt/vm8/src/test/java/org/apidesign/bck2brwsr/vm8/Defaults.java	Sun Sep 14 21:36:56 2014 +0200
     5.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.3 @@ -1,65 +0,0 @@
     5.4 -/**
     5.5 - * Back 2 Browser Bytecode Translator
     5.6 - * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
     5.7 - *
     5.8 - * This program is free software: you can redistribute it and/or modify
     5.9 - * it under the terms of the GNU General Public License as published by
    5.10 - * the Free Software Foundation, version 2 of the License.
    5.11 - *
    5.12 - * This program is distributed in the hope that it will be useful,
    5.13 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
    5.14 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5.15 - * GNU General Public License for more details.
    5.16 - *
    5.17 - * You should have received a copy of the GNU General Public License
    5.18 - * along with this program. Look for COPYING file in the top folder.
    5.19 - * If not, see http://opensource.org/licenses/GPL-2.0.
    5.20 - */
    5.21 -package org.apidesign.bck2brwsr.vm8;
    5.22 -
    5.23 -public interface Defaults {
    5.24 -    public static int staticValue() {
    5.25 -        return 42;
    5.26 -    }
    5.27 -    
    5.28 -    public default int value() {
    5.29 -        return 42;
    5.30 -    }
    5.31 -    
    5.32 -    public static Defaults create(int type) {
    5.33 -        class X implements Defaults {
    5.34 -        }
    5.35 -        class Y implements Defaults {
    5.36 -            @Override
    5.37 -            public int value() {
    5.38 -                return 7;
    5.39 -            }
    5.40 -        }
    5.41 -        class Z implements DoubleDefaults {
    5.42 -        }
    5.43 -        switch (type) {
    5.44 -            case 0: return new X();
    5.45 -            case 1: return new Y();
    5.46 -            default: return new Z();
    5.47 -        }
    5.48 -    }
    5.49 -    
    5.50 -    public static int defaultValue() {
    5.51 -        return create(0).value();
    5.52 -    }
    5.53 -    
    5.54 -    public static int myValue() {
    5.55 -        return create(1).value();
    5.56 -    }
    5.57 -
    5.58 -    public static int sndValue() {
    5.59 -        return create(2).value();
    5.60 -    }
    5.61 -    
    5.62 -    public interface DoubleDefaults extends Defaults {
    5.63 -        @Override
    5.64 -        public default int value() {
    5.65 -            return 84;
    5.66 -        }
    5.67 -    }
    5.68 -}
     6.1 --- a/rt/vm8/src/test/java/org/apidesign/bck2brwsr/vm8/Lambdas.java	Sun Sep 14 21:36:56 2014 +0200
     6.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.3 @@ -1,36 +0,0 @@
     6.4 -/**
     6.5 - * Back 2 Browser Bytecode Translator
     6.6 - * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
     6.7 - *
     6.8 - * This program is free software: you can redistribute it and/or modify
     6.9 - * it under the terms of the GNU General Public License as published by
    6.10 - * the Free Software Foundation, version 2 of the License.
    6.11 - *
    6.12 - * This program is distributed in the hope that it will be useful,
    6.13 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
    6.14 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6.15 - * GNU General Public License for more details.
    6.16 - *
    6.17 - * You should have received a copy of the GNU General Public License
    6.18 - * along with this program. Look for COPYING file in the top folder.
    6.19 - * If not, see http://opensource.org/licenses/GPL-2.0.
    6.20 - */
    6.21 -package org.apidesign.bck2brwsr.vm8;
    6.22 -
    6.23 -/**
    6.24 - *
    6.25 - * @author Jaroslav Tulach
    6.26 - */
    6.27 -public class Lambdas {
    6.28 -    private static void fewTimes(Runnable r, int cnt) {
    6.29 -        while (cnt-- > 0) {
    6.30 -            r.run();
    6.31 -        }
    6.32 -    }
    6.33 -    
    6.34 -    public static String compound() {
    6.35 -        StringBuilder sb = new StringBuilder();
    6.36 -        fewTimes(() -> sb.append('X'), 10);
    6.37 -        return sb.toString();
    6.38 -    }
    6.39 -}