30.11.2017

OpenJDK 9: Limitations/shortcomings of the Jshell

Jshell is a quite powerful tool to do some quick explorations and to write some scripts.

If found the following limitations:
  • No syntax highlighting
  • Only comments with // are allowed
    if you open a script file with
     /**
      *  My comments
      */
    this will work only many warnings.
    |  Error:
    |  illegal start of expression
    |   * Copyright (c) 1995, 2008, Oracle and/or its affiliates. All rights reserved.
    |   ^
    |  Error:
    |  illegal start of expression
    |   *
    |   ^
  • The usage of public, static, ... is quite different:
    -> public class MyClass {
    >> public int a;
    >> };
    |  Warning:
    |  Modifier 'public'  not permitted in top-level declarations, ignored
    |  public class MyClass {
    |  ^----^
    |  Added class MyClass this error is corrected:
    |      Modifier 'public'  not permitted in top-level declarations, ignored
    |      public class MyClass {
    |      ^----^

  • If you want to load a scipt with /open then tab completion does not work. The complete path including filename has to be typed / pasted.
  • If you load some example snippet, main(String[] args) is not run by default.
    Just tried with the swing tutorial from oracle:
    jshell Downloads/HelloWorldSwing.java  
    -> String[] mystringarray;
    |  Added variable mystringarray of type String[]

    -> HelloWorldSwing.main(mystringarray); 
  • .. 
to be continued...

Keine Kommentare:

Kommentar veröffentlichen