Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

README-180.html 2.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
  2. <html> <head>
  3. <title>AspectJ 1.8.0 Readme</title>
  4. <style type="text/css">
  5. <!--
  6. P { margin-left: 20px; }
  7. PRE { margin-left: 20px; }
  8. LI { margin-left: 20px; }
  9. H4 { margin-left: 20px; }
  10. H3 { margin-left: 10px; }
  11. -->
  12. </style>
  13. </head>
  14. <body>
  15. <div align="right"><small>
  16. &copy; Copyright 2014 Contributors.
  17. All rights reserved.
  18. </small></div>
  19. <h1>AspectJ 1.8.0 Readme</h1>
  20. <p>The full list of resolved issues in 1.8.0 is available
  21. <a href="https://bugs.eclipse.org/bugs/buglist.cgi?query_format=advanced;bug_status=RESOLVED;bug_status=VERIFIED;bug_status=CLOSED;product=AspectJ;target_milestone=1.8.0.M1;target_milestone=1.8.0;">here</a></h2>.</p>
  22. <ul>
  23. <li>1.8.0 available 17-Apr-2014
  24. <li>1.8.0.RC1 available 18-Mar-2014
  25. <li>1.8.0.M1 available 29-Jul-2013
  26. </ul>
  27. <h2>Notable changes</h2>
  28. <h3>Java 8 compilation</h3>
  29. <p>AspectJ has been updated to the latest available Eclipse Java
  30. compiler version that compiles Java8 code (the version available as a feature patch on top of Eclipse 4.3.2).</p>
  31. </p>
  32. <p>Here is a sample AspectJ8 program:</p>
  33. <pre><code>
  34. === 8< ==== C.java ==== 8< ===
  35. import java.util.Arrays;
  36. interface I {
  37. // Default method
  38. default void foo() {
  39. System.out.println("ABC");
  40. }
  41. }
  42. public class C implements I{
  43. public static void main(String[] args) {
  44. new C().foo();
  45. // Lambda
  46. Runnable r = () -> { System.out.println("hello world!"); };
  47. r.run();
  48. // Used Java8 b97
  49. Arrays.asList(MyClass.doSomething()).forEach((p) -> System.out.println(p));
  50. }
  51. }
  52. aspect X {
  53. before(): execution(* I.foo()) {
  54. System.out.println("I.foo running");
  55. }
  56. before(): staticinitialization(!X) {
  57. System.out.println("Clazz "+thisJoinPointStaticPart);
  58. }
  59. }
  60. class Utils {
  61. public static int compareByLength(String in, String out) {
  62. return in.length() - out.length();
  63. }
  64. }
  65. class MyClass {
  66. public static String[] doSomething() {
  67. String []args = new String[]{"4444","333","22","1"};
  68. // Method reference
  69. Arrays.sort(args,Utils::compareByLength);
  70. return args;
  71. }
  72. }
  73. === 8< ==== C.java ==== 8< ===
  74. </code></pre>
  75. <!-- ============================== -->
  76. </body>
  77. </html>