java:version:7

Java SE 7

  • JVM support for dynamic languages, with the new invokedynamic bytecode under JSR-292, following the prototyping work currently done on the Multi Language Virtual Machine
  • 압축된 64-bit 포인터 (available in Java 6 with -XX:+UseCompressedOops)
  • These small language changes (grouped under a project named Coin):
    • switch에서 String 사용 가능
    • try 구분에서 자동 자원 관리(try-with-resources 구문)
    • 다이아몬드 연산자 <> - 제너릭 인스턴스 생성을 위한 향상된 타입 추론
    • 가변인수 메서드 정의의 단순화(varargs)
    • Binary integer literals
    • Allowing underscores in numeric literals
  • Catching multiple exception types and rethrowing exceptions with improved type checking
  • 동시성 유틸리티 JSR 166
  • New file I/O library (defined by JSR 203) adding support for multiple file systems, file metadata and symbolic links. The new packages are java.nio.file, java.nio.file.attribute and java.nio.file.spi
  • Timsort is used to sort collections and arrays of objects instead of merge sort
  • Library-level support for elliptic curve cryptography algorithms
  • An XRender pipeline for Java 2D, which improves handling of features specific to modern GPUs
  • New platform APIs for the graphics features originally implemented in version 6u10 as unsupported APIs
  • Enhanced library-level support for new network protocols, including SCTP and Sockets Direct Protocol
  • Upstream updates to XML and Unicode
  • Java deployment rule sets
  • JVM : Dynamic Language support (`invokedynamic` * new byte operation)
  • 64bit pointer
  • switch(string) 문자열 허용
  • try: try(resource) close (AutoClosable, Closeable interface)
public static void main(String args[]) { // 이전
  FileInputStream fin = null;
  BufferedReader br = null; 
  try { 
    fin = new FileInputStream("info.xml"); 
    br = new BufferedReader(new InputStreamReader(fin)); 
    if (br.ready()) { 
      String line1 = br.readLine(); 
      System.out.println(line1); 
    } 
  } catch (Exception ex) { 
    System.out.println("error!!"); 
  } finally { 
    try {
      if (fin != null) fin.close(); 
      if (br != null) br.close(); 
    } catch (IOException ie) { 
      System.out.println("Failed to close files"); 
    } 
  } 
}
 
public static void main(String args[]) {
  try (FileInputStream fin = new FileInputStream("info.xml");
       BufferedReader br = new BufferedReader(new InputStreamReader(fin));) {
    if (br.ready()) {
      String line1 = br.readLine();
      System.out.println(line1);
    }
  } catch (Exception ex) {
    System.out.println("error");
  }
}
  • generics 내 타입 추론: < > 연산자
// 이전 버전
Map<String, Object> user = new HashMap<String, Object>();
// 추론
Map<String, Object> user = new HashMap<> ();
  • varargs 단순화 정의
  • Binary integer Literals
  • underscore 000_000_000
  • Catching multiple exception types
  • API
    • Concurrency 강화
    • NIO: java.nio.file, java.nio.file.attribute, java.nio.file.spi
    • sort강화 (merge sort)
    • crypto강화
    • GPU강화
  • JavaFX가 기본으로 포함
    • 정식 G1 GC
  • 안정적인 ARM지원
  • 한정적 와일드 카드 사용시 정확한 추론 못함. → 명시적 타입 인수(explicit type arguement)사용 또는 1.8 사용
  • java/version/7.txt
  • 마지막으로 수정됨: 2024/01/28 12:02
  • 저자 writer