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-1.8.0.adoc 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. == AspectJ 1.8.0
  2. _© Copyright 2014 Contributors. All rights reserved._
  3. The full list of resolved issues in 1.8.0 is available
  4. 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]
  5. _Release info:_
  6. * _1.8.0 available 17-Apr-2014_
  7. * _1.8.0.RC1 available 18-Mar-2014_
  8. * _1.8.0.M1 available 29-Jul-2013_
  9. === Notable changes
  10. ==== Java 8 compilation
  11. AspectJ has been updated to the latest available Eclipse Java compiler
  12. version that compiles Java8 code (the version available as a feature
  13. patch on top of Eclipse 4.3.2).
  14. Here is a sample AspectJ8 program:
  15. [source, java]
  16. ....
  17. // === 8< ==== C.java ==== 8< ===
  18. import java.util.Arrays;
  19. interface I {
  20. // Default method
  21. default void foo() {
  22. System.out.println("ABC");
  23. }
  24. }
  25. public class C implements I{
  26. public static void main(String[] args) {
  27. new C().foo();
  28. // Lambda
  29. Runnable r = () -> { System.out.println("hello world!"); };
  30. r.run();
  31. // Used Java8 b97
  32. Arrays.asList(MyClass.doSomething()).forEach((p) -> System.out.println(p));
  33. }
  34. }
  35. aspect X {
  36. before(): execution(* I.foo()) {
  37. System.out.println("I.foo running");
  38. }
  39. before(): staticinitialization(!X) {
  40. System.out.println("Clazz "+thisJoinPointStaticPart);
  41. }
  42. }
  43. class Utils {
  44. public static int compareByLength(String in, String out) {
  45. return in.length() - out.length();
  46. }
  47. }
  48. class MyClass {
  49. public static String[] doSomething() {
  50. String []args = new String[]{"4444","333","22","1"};
  51. // Method reference
  52. Arrays.sort(args,Utils::compareByLength);
  53. return args;
  54. }
  55. }
  56. // === 8< ==== C.java ==== 8< ===
  57. ....