You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by gn...@apache.org on 2018/04/19 18:08:34 UTC

svn commit: r1829594 [2/2] - in /felix/trunk/gogo: command/src/main/java/org/apache/felix/gogo/command/ jline/src/main/java/org/apache/felix/gogo/jline/ jline/src/test/java/org/apache/felix/gogo/jline/ jline/src/test/java/org/apache/felix/gogo/jline/ss...

Modified: felix/trunk/gogo/runtime/src/main/java/org/apache/felix/service/command/CommandProcessor.java
URL: http://svn.apache.org/viewvc/felix/trunk/gogo/runtime/src/main/java/org/apache/felix/service/command/CommandProcessor.java?rev=1829594&r1=1829593&r2=1829594&view=diff
==============================================================================
--- felix/trunk/gogo/runtime/src/main/java/org/apache/felix/service/command/CommandProcessor.java (original)
+++ felix/trunk/gogo/runtime/src/main/java/org/apache/felix/service/command/CommandProcessor.java Thu Apr 19 18:08:33 2018
@@ -32,7 +32,7 @@ public interface CommandProcessor
      * The scope of commands provided by this service. This name can be used to distinguish
      * between different command providers with the same function names.
      */
-    final static String COMMAND_SCOPE = "osgi.command.scope";
+    String COMMAND_SCOPE = "osgi.command.scope";
 
     /**
      * A list of method names that may be called for this command provider. A
@@ -42,7 +42,7 @@ public interface CommandProcessor
      * Help information for the command may be supplied with a space as
      * separation.
      */
-    final static String COMMAND_FUNCTION = "osgi.command.function";
+    String COMMAND_FUNCTION = "osgi.command.function";
 
     /**
      * Create a new command session associated with IO streams.

Modified: felix/trunk/gogo/runtime/src/main/java/org/apache/felix/service/command/Parameter.java
URL: http://svn.apache.org/viewvc/felix/trunk/gogo/runtime/src/main/java/org/apache/felix/service/command/Parameter.java?rev=1829594&r1=1829593&r2=1829594&view=diff
==============================================================================
--- felix/trunk/gogo/runtime/src/main/java/org/apache/felix/service/command/Parameter.java (original)
+++ felix/trunk/gogo/runtime/src/main/java/org/apache/felix/service/command/Parameter.java Thu Apr 19 18:08:33 2018
@@ -27,7 +27,7 @@ import java.lang.annotation.Target;
 @Target({ElementType.PARAMETER})
 public @interface Parameter
 {
-    static final String UNSPECIFIED = "org.apache.felix.service.command.unspecified.parameter";
+    String UNSPECIFIED = "org.apache.felix.service.command.unspecified.parameter";
 
     /**
      * Parameter name and aliases which must start with the hyphen character.

Modified: felix/trunk/gogo/runtime/src/test/java/org/apache/felix/gogo/runtime/AbstractParserTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/gogo/runtime/src/test/java/org/apache/felix/gogo/runtime/AbstractParserTest.java?rev=1829594&r1=1829593&r2=1829594&view=diff
==============================================================================
--- felix/trunk/gogo/runtime/src/test/java/org/apache/felix/gogo/runtime/AbstractParserTest.java (original)
+++ felix/trunk/gogo/runtime/src/test/java/org/apache/felix/gogo/runtime/AbstractParserTest.java Thu Apr 19 18:08:33 2018
@@ -36,7 +36,7 @@ public abstract class AbstractParserTest
     private PrintStream serr;
 
     @Before
-    public void setUp() throws Exception {
+    public void setUp() {
         sin = new NoCloseInputStream(System.in);
         sout = new NoClosePrintStream(System.out);
         serr = new NoClosePrintStream(System.err);
@@ -45,7 +45,7 @@ public abstract class AbstractParserTest
     }
 
     @After
-    public void tearDown() throws Exception {
+    public void tearDown() {
         threadIO.stop();
     }
 
@@ -60,7 +60,7 @@ public abstract class AbstractParserTest
             super(in);
         }
         @Override
-        public void close() throws IOException {
+        public void close() {
         }
     }
 

Modified: felix/trunk/gogo/runtime/src/test/java/org/apache/felix/gogo/runtime/ExpanderTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/gogo/runtime/src/test/java/org/apache/felix/gogo/runtime/ExpanderTest.java?rev=1829594&r1=1829593&r2=1829594&view=diff
==============================================================================
--- felix/trunk/gogo/runtime/src/test/java/org/apache/felix/gogo/runtime/ExpanderTest.java (original)
+++ felix/trunk/gogo/runtime/src/test/java/org/apache/felix/gogo/runtime/ExpanderTest.java Thu Apr 19 18:08:33 2018
@@ -36,7 +36,7 @@ public class ExpanderTest {
     public void testOctalAndHex() throws Exception {
         Evaluate evaluate = new Evaluate() {
             @Override
-            public Object eval(Token t) throws Exception {
+            public Object eval(Token t) {
                 return null;
             }
             @Override
@@ -63,7 +63,7 @@ public class ExpanderTest {
     public void testSortingFlags() throws Exception {
         Evaluate evaluate = new Evaluate() {
             @Override
-            public Object eval(Token t) throws Exception {
+            public Object eval(Token t) {
                 return null;
             }
             @Override
@@ -110,7 +110,7 @@ public class ExpanderTest {
         final Path testdir = Paths.get(".").toAbsolutePath().resolve("target/testdir").normalize();
         Evaluate evaluate = new Evaluate() {
             @Override
-            public Object eval(Token t) throws Exception {
+            public Object eval(Token t) {
                 return null;
             }
             @Override

Modified: felix/trunk/gogo/runtime/src/test/java/org/apache/felix/gogo/runtime/GlobPathMatcherTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/gogo/runtime/src/test/java/org/apache/felix/gogo/runtime/GlobPathMatcherTest.java?rev=1829594&r1=1829593&r2=1829594&view=diff
==============================================================================
--- felix/trunk/gogo/runtime/src/test/java/org/apache/felix/gogo/runtime/GlobPathMatcherTest.java (original)
+++ felix/trunk/gogo/runtime/src/test/java/org/apache/felix/gogo/runtime/GlobPathMatcherTest.java Thu Apr 19 18:08:33 2018
@@ -30,7 +30,7 @@ import static org.junit.Assert.assertTru
 public class GlobPathMatcherTest {
 
     @Test
-    public void isMatchWithCaseSensitiveWithDefaultPathSeparator() throws Exception {
+    public void isMatchWithCaseSensitiveWithDefaultPathSeparator() {
 
         final Builder.Matcher pathMatcher = new Builder().build();
 
@@ -143,7 +143,7 @@ public class GlobPathMatcherTest {
     }
 
     @Test
-    public void isMatchWithCustomSeparator() throws Exception {
+    public void isMatchWithCustomSeparator() {
         final Builder.Matcher pathMatcher = new Builder().withPathSeparator(".").build();
 
         assertTrue(pathMatcher.isMatch(".foo.bar.**", ".foo.bar"));
@@ -182,7 +182,7 @@ public class GlobPathMatcherTest {
     }
 
     @Test
-    public void isMatchWithIgnoreCase() throws Exception {
+    public void isMatchWithIgnoreCase() {
         final Builder.Matcher pathMatcher = new Builder().withIgnoreCase().build();
 
         assertTrue(pathMatcher.isMatch("/foo/bar/**", "/FoO/baR"));
@@ -200,7 +200,7 @@ public class GlobPathMatcherTest {
     }
 
     @Test
-    public void isMatchWithIgnoreCaseWithCustomPathSeparator() throws Exception {
+    public void isMatchWithIgnoreCaseWithCustomPathSeparator() {
         final Builder.Matcher pathMatcher = new Builder()
                 .withIgnoreCase()
                 .withPathSeparator(".").build();

Modified: felix/trunk/gogo/runtime/src/test/java/org/apache/felix/gogo/runtime/ReflectiveTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/gogo/runtime/src/test/java/org/apache/felix/gogo/runtime/ReflectiveTest.java?rev=1829594&r1=1829593&r2=1829594&view=diff
==============================================================================
--- felix/trunk/gogo/runtime/src/test/java/org/apache/felix/gogo/runtime/ReflectiveTest.java (original)
+++ felix/trunk/gogo/runtime/src/test/java/org/apache/felix/gogo/runtime/ReflectiveTest.java Thu Apr 19 18:08:33 2018
@@ -43,11 +43,11 @@ public class ReflectiveTest {
 
     @Test
     public void testArrayInvocation() throws Exception {
-        assertEquals(new Object[] { 1, "ab" }, invoke("test1", Arrays.<Object>asList(1, "ab")));
-        assertEquals(new String[] { "1", "ab" }, invoke("test2", Arrays.<Object>asList(1, "ab")));
+        assertEquals(new Object[] { 1, "ab" }, invoke("test1", Arrays.asList(1, "ab")));
+        assertEquals(new String[] { "1", "ab" }, invoke("test2", Arrays.asList(1, "ab")));
 
         assertEquals(new Object[] { Arrays.asList(1, 2), "ab" }, invoke("test1", Arrays.asList(Arrays.asList(1, 2), "ab")));
-        assertEquals(new Object[] { new Object[] { 1, 2 }, "ab" }, invoke("test1", Arrays.<Object>asList(new Object[] { 1, 2 }, "ab")));
+        assertEquals(new Object[] { new Object[] { 1, 2 }, "ab" }, invoke("test1", Arrays.asList(new Object[] { 1, 2 }, "ab")));
     }
 
     @Test
@@ -57,16 +57,16 @@ public class ReflectiveTest {
         CommandProcessorImpl processor = new CommandProcessorImpl(null);
         Converter conv = new Converter() {
             @Override
-            public Object convert(Class<?> desiredType, Object in) throws Exception {
+            public Object convert(Class<?> desiredType, Object in) {
                 return null;
             }
             @Override
-            public CharSequence format(Object target, int level, Converter escape) throws Exception {
+            public CharSequence format(Object target, int level, Converter escape) {
                 return null;
             }
         };
         Reflective.invoke(new CommandSessionImpl(processor, in, out, out), processor, "addConverter",
-                Collections.<Object>singletonList(conv));
+                Collections.singletonList(conv));
     }
 
     static class Target {

Modified: felix/trunk/gogo/runtime/src/test/java/org/apache/felix/gogo/runtime/TestParser.java
URL: http://svn.apache.org/viewvc/felix/trunk/gogo/runtime/src/test/java/org/apache/felix/gogo/runtime/TestParser.java?rev=1829594&r1=1829593&r2=1829594&view=diff
==============================================================================
--- felix/trunk/gogo/runtime/src/test/java/org/apache/felix/gogo/runtime/TestParser.java (original)
+++ felix/trunk/gogo/runtime/src/test/java/org/apache/felix/gogo/runtime/TestParser.java Thu Apr 19 18:08:33 2018
@@ -45,13 +45,10 @@ public class TestParser extends Abstract
     int beentheredonethat = 0;
 
     @Test
-    public void testError() throws Exception {
+    public void testError() {
         Context context = new Context();
-        context.addCommand("gogo", new Function() {
-            @Override
-            public Object execute(CommandSession session, List<Object> arguments) throws Exception {
-                throw new Error(arguments.get(0).toString());
-            }
+        context.addCommand("gogo", (Function) (session, arguments) -> {
+            throw new Error(arguments.get(0).toString());
         }, "error");
         try {
             context.execute("error bar");
@@ -511,7 +508,7 @@ public class TestParser extends Abstract
     void each(CommandSession session, Collection<Object> list, Function closure)
         throws Exception
     {
-        List<Object> args = new ArrayList<Object>();
+        List<Object> args = new ArrayList<>();
         args.add(null);
         for (Object x : list)
         {

Modified: felix/trunk/gogo/runtime/src/test/java/org/apache/felix/gogo/runtime/TestParser3.java
URL: http://svn.apache.org/viewvc/felix/trunk/gogo/runtime/src/test/java/org/apache/felix/gogo/runtime/TestParser3.java?rev=1829594&r1=1829593&r2=1829594&view=diff
==============================================================================
--- felix/trunk/gogo/runtime/src/test/java/org/apache/felix/gogo/runtime/TestParser3.java (original)
+++ felix/trunk/gogo/runtime/src/test/java/org/apache/felix/gogo/runtime/TestParser3.java Thu Apr 19 18:08:33 2018
@@ -35,11 +35,11 @@ public class TestParser3 extends Abstrac
         c.addCommand("echo", this);
 
         assertEquals("10d", c.execute("echo %(2*(3+2))d"));
-        assertEquals(3l, c.execute("%(1+2)"));
+        assertEquals(3L, c.execute("%(1+2)"));
 
-        c.set("a", 2l);
-        assertEquals(3l, c.execute("%(a+=1)"));
-        assertEquals(3l, c.get("a"));
+        c.set("a", 2L);
+        assertEquals(3L, c.execute("%(a+=1)"));
+        assertEquals(3L, c.get("a"));
     }
 
     public CharSequence echo(Object args[])

Modified: felix/trunk/gogo/runtime/src/test/java/org/apache/felix/gogo/runtime/TestTokenizer.java
URL: http://svn.apache.org/viewvc/felix/trunk/gogo/runtime/src/test/java/org/apache/felix/gogo/runtime/TestTokenizer.java?rev=1829594&r1=1829593&r2=1829594&view=diff
==============================================================================
--- felix/trunk/gogo/runtime/src/test/java/org/apache/felix/gogo/runtime/TestTokenizer.java (original)
+++ felix/trunk/gogo/runtime/src/test/java/org/apache/felix/gogo/runtime/TestTokenizer.java Thu Apr 19 18:08:33 2018
@@ -56,8 +56,7 @@ public class TestTokenizer
     {
         evaluate = new Evaluate()
         {
-            public Object eval(Token t) throws Exception
-            {
+            public Object eval(Token t) {
                 throw new UnsupportedOperationException("eval not implemented.");
             }
 
@@ -118,8 +117,7 @@ public class TestTokenizer
     }
 
     // hello world
-    private void testHello(CharSequence text) throws Exception
-    {
+    private void testHello(CharSequence text) {
         Tokenizer t = new Tokenizer(text);
         assertEquals("hello", t.next().toString());
         assertEquals("world", t.next().toString());
@@ -134,8 +132,7 @@ public class TestTokenizer
     }
 
     // 'single quote' "double quote"
-    private void testString(CharSequence text) throws Exception
-    {
+    private void testString(CharSequence text) {
         Tokenizer t = new Tokenizer(text);
         assertEquals("'single $quote'", t.next().toString());
         assertEquals("\"double $quote\"", t.next().toString());
@@ -155,8 +152,7 @@ public class TestTokenizer
     //
     // x = {echo $args};
     //
-    private void testClosure2(CharSequence text) throws Exception
-    {
+    private void testClosure2(CharSequence text) {
         Tokenizer t = new Tokenizer(text);
         assertEquals("x", t.next().toString());
         assertEquals("=", t.next().toString());
@@ -170,8 +166,7 @@ public class TestTokenizer
         assertEquals(null, t.next());
     }
 
-    private void token1(CharSequence text) throws Exception
-    {
+    private void token1(CharSequence text) {
         Tokenizer t = new Tokenizer(text);
         assertEquals("{", t.next().toString());
         assertEquals("echo", t.next().toString());
@@ -481,8 +476,7 @@ public class TestTokenizer
     }
 
     @Test
-    public void testParser() throws Exception
-    {
+    public void testParser() {
         new Parser("// comment\n" + "a=\"who's there?\"; ps -ef;\n" + "ls | \n grep y\n").program();
         String p1 = "a=1 \\$b=2 c={closure}\n";
         new Parser(p1).program();
@@ -547,7 +541,7 @@ public class TestTokenizer
     }
 
     @Test
-    public void testHereDocMissing() throws Exception {
+    public void testHereDocMissing() {
         try {
             new Parser("a <<").statement();
             fail("Expected exception");

Modified: felix/trunk/gogo/runtime/src/test/java/org/apache/felix/gogo/runtime/expr/ExpressionTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/gogo/runtime/src/test/java/org/apache/felix/gogo/runtime/expr/ExpressionTest.java?rev=1829594&r1=1829593&r2=1829594&view=diff
==============================================================================
--- felix/trunk/gogo/runtime/src/test/java/org/apache/felix/gogo/runtime/expr/ExpressionTest.java (original)
+++ felix/trunk/gogo/runtime/src/test/java/org/apache/felix/gogo/runtime/expr/ExpressionTest.java Thu Apr 19 18:08:33 2018
@@ -30,31 +30,31 @@ public class ExpressionTest {
     @Test
     public void testExpr() {
 
-        Map<String, Object> variables = new HashMap<String, Object>();
+        Map<String, Object> variables = new HashMap<>();
         variables.put("a", 2d);
-        variables.put("b", 5l);
-        variables.put("c", 1l);
-        variables.put("d", 2l);
+        variables.put("b", 5L);
+        variables.put("c", 1L);
+        variables.put("d", 2L);
         variables.put("s", " foo ");
         variables.put("t", "bar");
 
-        Assert.assertEquals(4l, new Expression("c+=1, d+=2").eval(variables));
+        Assert.assertEquals(4L, new Expression("c+=1, d+=2").eval(variables));
 
         Assert.assertEquals(" foo ", new Expression("\" foo \"").eval());
         Assert.assertEquals(" foo bar", new Expression("s + t").eval(variables));
-        Assert.assertEquals(1l, new Expression("s < t").eval(variables));
-        Assert.assertEquals(1l, new Expression("s > t || t == \"bar\"").eval(variables));
+        Assert.assertEquals(1L, new Expression("s < t").eval(variables));
+        Assert.assertEquals(1L, new Expression("s > t || t == \"bar\"").eval(variables));
 
-        Assert.assertEquals(3l, new Expression("a += 1").eval(variables));
-        Assert.assertEquals(3l, variables.get("a"));
+        Assert.assertEquals(3L, new Expression("a += 1").eval(variables));
+        Assert.assertEquals(3L, variables.get("a"));
 
-        Assert.assertEquals(30l, new Expression("10 + 20 | 30").eval());
+        Assert.assertEquals(30L, new Expression("10 + 20 | 30").eval());
 
-        Assert.assertEquals(8l, new Expression("a + b").eval(variables));
-        Assert.assertEquals(3l, new Expression("if(a < b, a, b)").eval(variables));
+        Assert.assertEquals(8L, new Expression("a + b").eval(variables));
+        Assert.assertEquals(3L, new Expression("if(a < b, a, b)").eval(variables));
 
-        Assert.assertEquals(16l, new Expression("2 + 2 << 2").eval());
-        Assert.assertEquals(8l, new Expression("2 | 2 << 2").eval());
+        Assert.assertEquals(16L, new Expression("2 + 2 << 2").eval());
+        Assert.assertEquals(8L, new Expression("2 | 2 << 2").eval());
     }
 
 }

Modified: felix/trunk/gogo/runtime/src/test/java/org/apache/felix/gogo/runtime/threadio/TestThreadIO.java
URL: http://svn.apache.org/viewvc/felix/trunk/gogo/runtime/src/test/java/org/apache/felix/gogo/runtime/threadio/TestThreadIO.java?rev=1829594&r1=1829593&r2=1829594&view=diff
==============================================================================
--- felix/trunk/gogo/runtime/src/test/java/org/apache/felix/gogo/runtime/threadio/TestThreadIO.java (original)
+++ felix/trunk/gogo/runtime/src/test/java/org/apache/felix/gogo/runtime/threadio/TestThreadIO.java Thu Apr 19 18:08:33 2018
@@ -39,7 +39,7 @@ public class TestThreadIO {
     {
         ThreadIOImpl tio = new ThreadIOImpl();
         tio.start();
-        List<ByteArrayOutputStream> list = new ArrayList<ByteArrayOutputStream>();
+        List<ByteArrayOutputStream> list = new ArrayList<>();
         for (int i = 0; i < 10; i++)
         {
             ByteArrayOutputStream out = new ByteArrayOutputStream();

Modified: felix/trunk/gogo/shell/src/main/java/org/apache/felix/gogo/options/Option.java
URL: http://svn.apache.org/viewvc/felix/trunk/gogo/shell/src/main/java/org/apache/felix/gogo/options/Option.java?rev=1829594&r1=1829593&r2=1829594&view=diff
==============================================================================
--- felix/trunk/gogo/shell/src/main/java/org/apache/felix/gogo/options/Option.java (original)
+++ felix/trunk/gogo/shell/src/main/java/org/apache/felix/gogo/options/Option.java Thu Apr 19 18:08:33 2018
@@ -45,7 +45,7 @@ public interface Option {
      * @param skipArg0
      * @return
      */
-    Option parse(List<? extends Object> argv, boolean skipArg0);
+    Option parse(List<?> argv, boolean skipArg0);
 
     /**
      * parse arguments.
@@ -53,7 +53,7 @@ public interface Option {
      * @see {@link #parse(List, boolean)
 
      */
-    Option parse(List<? extends Object> argv);
+    Option parse(List<?> argv);
 
     /**
      * parse arguments.

Modified: felix/trunk/gogo/shell/src/main/java/org/apache/felix/gogo/options/Options.java
URL: http://svn.apache.org/viewvc/felix/trunk/gogo/shell/src/main/java/org/apache/felix/gogo/options/Options.java?rev=1829594&r1=1829593&r2=1829594&view=diff
==============================================================================
--- felix/trunk/gogo/shell/src/main/java/org/apache/felix/gogo/options/Options.java (original)
+++ felix/trunk/gogo/shell/src/main/java/org/apache/felix/gogo/options/Options.java Thu Apr 19 18:08:33 2018
@@ -98,12 +98,12 @@ public class Options implements Option
 
     private final Map<String, Boolean> unmodifiableOptSet;
     private final Map<String, Object> unmodifiableOptArg;
-    private final Map<String, Boolean> optSet = new HashMap<String, Boolean>();
-    private final Map<String, Object> optArg = new HashMap<String, Object>();
+    private final Map<String, Boolean> optSet = new HashMap<>();
+    private final Map<String, Object> optArg = new HashMap<>();
 
-    private final Map<String, String> optName = new HashMap<String, String>();
-    private final Map<String, String> optAlias = new HashMap<String, String>();
-    private final List<Object> xargs = new ArrayList<Object>();
+    private final Map<String, String> optName = new HashMap<>();
+    private final Map<String, String> optAlias = new HashMap<>();
+    private final List<Object> xargs = new ArrayList<>();
     private List<String> args = null;
 
     private static final String UNKNOWN = "unknown";
@@ -185,7 +185,7 @@ public class Options implements Option
 
         if (arg instanceof String)
         { // default value
-            list = new ArrayList<Object>();
+            list = new ArrayList<>();
             if (!"".equals(arg))
             {
                 list.add(arg);
@@ -201,7 +201,7 @@ public class Options implements Option
 
     public List<String> getList(String name)
     {
-        ArrayList<String> list = new ArrayList<String>();
+        ArrayList<String> list = new ArrayList<>();
         for (Object o : getObjectList(name))
         {
             try
@@ -224,7 +224,7 @@ public class Options implements Option
 
         if (arg instanceof String)
         { // default value
-            list = new ArrayList<Object>();
+            list = new ArrayList<>();
             optArg.put(name, list);
         }
         else
@@ -273,7 +273,7 @@ public class Options implements Option
     {
         if (args == null)
         {
-            args = new ArrayList<String>();
+            args = new ArrayList<>();
             for (Object arg : xargs)
             {
                 args.add(arg == null ? "null" : arg.toString());
@@ -330,14 +330,14 @@ public class Options implements Option
         }
         else
         {
-            ArrayList<String> list = new ArrayList<String>();
+            ArrayList<String> list = new ArrayList<>();
             list.addAll(Arrays.asList(spec));
             list.addAll(Arrays.asList(gspec != null ? gspec : gopt.gspec));
             this.spec = list.toArray(new String[0]);
         }
 
-        Map<String, Boolean> myOptSet = new HashMap<String, Boolean>();
-        Map<String, Object> myOptArg = new HashMap<String, Object>();
+        Map<String, Boolean> myOptSet = new HashMap<>();
+        Map<String, Object> myOptArg = new HashMap<>();
 
         parseSpec(myOptSet, myOptArg);
 
@@ -452,7 +452,7 @@ public class Options implements Option
         return parse(argv, false);
     }
 
-    public Option parse(List<? extends Object> argv)
+    public Option parse(List<?> argv)
     {
         return parse(argv, false);
     }
@@ -466,12 +466,10 @@ public class Options implements Option
         return parse(Arrays.asList(argv), skipArg0);
     }
 
-    public Option parse(List<? extends Object> argv, boolean skipArg0)
+    public Option parse(List<?> argv, boolean skipArg0)
     {
         reset();
-        List<Object> args = new ArrayList<Object>();
-        args.addAll(Arrays.asList(defArgs));
-
+        List<Object> args = new ArrayList<>(Arrays.asList(defArgs));
         for (Object arg : argv)
         {
             if (skipArg0)
@@ -522,7 +520,7 @@ public class Options implements Option
                     int eq = arg.indexOf("=");
                     String value = (eq == -1) ? null : arg.substring(eq + 1);
                     String name = arg.substring(2, ((eq == -1) ? arg.length() : eq));
-                    List<String> names = new ArrayList<String>();
+                    List<String> names = new ArrayList<>();
 
                     if (optSet.containsKey(name))
                     {

Modified: felix/trunk/gogo/shell/src/main/java/org/apache/felix/gogo/shell/Activator.java
URL: http://svn.apache.org/viewvc/felix/trunk/gogo/shell/src/main/java/org/apache/felix/gogo/shell/Activator.java?rev=1829594&r1=1829593&r2=1829594&view=diff
==============================================================================
--- felix/trunk/gogo/shell/src/main/java/org/apache/felix/gogo/shell/Activator.java (original)
+++ felix/trunk/gogo/shell/src/main/java/org/apache/felix/gogo/shell/Activator.java Thu Apr 19 18:08:33 2018
@@ -52,22 +52,20 @@ public class Activator implements Bundle
 
     public Activator()
     {
-        regs = new HashSet<ServiceRegistration>();
+        regs = new HashSet<>();
     }
 
-    public void start(BundleContext context) throws Exception
-    {
+    public void start(BundleContext context) {
         this.context = context;
         this.commandProcessorTracker = createCommandProcessorTracker();
         this.commandProcessorTracker.open();
     }
 
-    public void stop(BundleContext context) throws Exception
-    {
-        Set<ServiceRegistration> currentRegs = new HashSet<ServiceRegistration>();
+    public void stop(BundleContext context) {
+        Set<ServiceRegistration> currentRegs;
         synchronized (regs)
         {
-            currentRegs.addAll(regs);
+            currentRegs = new HashSet<>(regs);
             regs.clear();
         }
 
@@ -81,20 +79,20 @@ public class Activator implements Bundle
         stopShell();
     }
 
-    private ServiceTracker createCommandProcessorTracker()
+    private ServiceTracker<CommandProcessor, CommandProcessor> createCommandProcessorTracker()
     {
-        return new ServiceTracker(context, CommandProcessor.class.getName(), null)
+        return new ServiceTracker<CommandProcessor, CommandProcessor>(context, CommandProcessor.class, null)
         {
             @Override
-            public Object addingService(ServiceReference reference)
+            public CommandProcessor addingService(ServiceReference<CommandProcessor> reference)
             {
-                CommandProcessor processor = (CommandProcessor) super.addingService(reference);
+                CommandProcessor processor = super.addingService(reference);
                 startShell(context, processor);
                 return processor;
             }
 
             @Override
-            public void removedService(ServiceReference reference, Object service)
+            public void removedService(ServiceReference<CommandProcessor> reference, CommandProcessor service)
             {
                 stopShell();
                 super.removedService(reference, service);
@@ -104,10 +102,10 @@ public class Activator implements Bundle
 
     private void startShell(BundleContext context, CommandProcessor processor)
     {
-        Dictionary<String, Object> dict = new Hashtable<String, Object>();
+        Dictionary<String, Object> dict = new Hashtable<>();
         dict.put(CommandProcessor.COMMAND_SCOPE, "gogo");
 
-        Set<ServiceRegistration> currentRegs = new HashSet<ServiceRegistration>();
+        Set<ServiceRegistration> currentRegs = new HashSet<>();
 
         // register converters
         currentRegs.add(context.registerService(Converter.class.getName(), new Converters(context.getBundle(0).getBundleContext()), null));
@@ -137,13 +135,7 @@ public class Activator implements Bundle
         }
 
         // start shell on a separate thread...
-        executor = Executors.newSingleThreadExecutor(new ThreadFactory()
-        {
-            public Thread newThread(Runnable runnable)
-            {
-                return new Thread(runnable, "Gogo shell");
-            }
-        });
+        executor = Executors.newSingleThreadExecutor(runnable -> new Thread(runnable, "Gogo shell"));
         shellJob = new StartShellJob(context, processor);
         executor.submit(shellJob);
     }

Modified: felix/trunk/gogo/shell/src/main/java/org/apache/felix/gogo/shell/Builtin.java
URL: http://svn.apache.org/viewvc/felix/trunk/gogo/shell/src/main/java/org/apache/felix/gogo/shell/Builtin.java?rev=1829594&r1=1829593&r2=1829594&view=diff
==============================================================================
--- felix/trunk/gogo/shell/src/main/java/org/apache/felix/gogo/shell/Builtin.java (original)
+++ felix/trunk/gogo/shell/src/main/java/org/apache/felix/gogo/shell/Builtin.java Thu Apr 19 18:08:33 2018
@@ -162,8 +162,7 @@ public class Builtin
         return Class.forName(name);
     }
 
-    public void set(CommandSession session, String[] argv) throws Exception
-    {
+    public void set(CommandSession session, String[] argv) {
         final String[] usage = {
                 "set - show session variables",
                 "Usage: set [OPTIONS] [PREFIX]",
@@ -195,7 +194,7 @@ public class Builtin
         else
         {
             boolean all = opt.isSet("all");
-            for (String key : new TreeSet<String>(Shell.getVariables(session)))
+            for (String key : new TreeSet<>(Shell.getVariables(session)))
             {
                 if (!key.startsWith(prefix))
                     continue;
@@ -209,7 +208,7 @@ public class Builtin
 
                 if (target != null)
                 {
-                    Class<? extends Object> clazz = target.getClass();
+                    Class<?> clazz = target.getClass();
                     type = clazz.getSimpleName();
                     value = target.toString();
                 }
@@ -254,7 +253,7 @@ public class Builtin
 
         if (opt.isSet("list"))
         {
-            list = new ArrayList<String>();
+            list = new ArrayList<>();
         }
 
         boolean first = true;
@@ -331,7 +330,7 @@ public class Builtin
 
         if (optScope != null || (args.isEmpty() && all))
         {
-            Set<String> snames = new TreeSet<String>();
+            Set<String> snames = new TreeSet<>();
 
             for (String sname : (getCommands(session)))
             {
@@ -351,7 +350,7 @@ public class Builtin
 
         if (args.size() == 0)
         {
-            Map<String, Integer> scopes = new TreeMap<String, Integer>();
+            Map<String, Integer> scopes = new TreeMap<>();
 
             for (String sname : getCommands(session))
             {
@@ -379,7 +378,7 @@ public class Builtin
         final String MAIN = "_main"; // FIXME: must match Reflective.java
 
         StringBuilder buf = new StringBuilder();
-        Set<String> cmds = new LinkedHashSet<String>();
+        Set<String> cmds = new LinkedHashSet<>();
 
         // get all commands
         if ((colon != -1) || (session.get(name) != null))
@@ -564,7 +563,7 @@ public class Builtin
             target = method.invoke(target, (Object[])null);
         }
 
-        ArrayList<Method> list = new ArrayList<Method>();
+        ArrayList<Method> list = new ArrayList<>();
         Class<?> tc = (target instanceof Class<?>) ? (Class<?>) target
             : target.getClass();
         Method[] methods = tc.getMethods();
@@ -583,14 +582,14 @@ public class Builtin
         return list;
     }
 
-    private final static Set<String> KEYWORDS = new HashSet<String>(
-        Arrays.asList(new String[] { "abstract", "continue", "for", "new", "switch",
-                "assert", "default", "goto", "package", "synchronized", "boolean", "do",
-                "if", "private", "this", "break", "double", "implements", "protected",
-                "throw", "byte", "else", "import", "public", "throws", "case", "enum",
-                "instanceof", "return", "transient", "catch", "extends", "int", "short",
-                "try", "char", "final", "interface", "static", "void", "class",
-                "finally", "long", "strictfp", "volatile", "const", "float", "native",
-                "super", "while" }));
+    private final static Set<String> KEYWORDS = new HashSet<>(
+            Arrays.asList("abstract", "continue", "for", "new", "switch",
+                    "assert", "default", "goto", "package", "synchronized", "boolean", "do",
+                    "if", "private", "this", "break", "double", "implements", "protected",
+                    "throw", "byte", "else", "import", "public", "throws", "case", "enum",
+                    "instanceof", "return", "transient", "catch", "extends", "int", "short",
+                    "try", "char", "final", "interface", "static", "void", "class",
+                    "finally", "long", "strictfp", "volatile", "const", "float", "native",
+                    "super", "while"));
 
 }

Modified: felix/trunk/gogo/shell/src/main/java/org/apache/felix/gogo/shell/Converters.java
URL: http://svn.apache.org/viewvc/felix/trunk/gogo/shell/src/main/java/org/apache/felix/gogo/shell/Converters.java?rev=1829594&r1=1829593&r2=1829594&view=diff
==============================================================================
--- felix/trunk/gogo/shell/src/main/java/org/apache/felix/gogo/shell/Converters.java (original)
+++ felix/trunk/gogo/shell/src/main/java/org/apache/felix/gogo/shell/Converters.java Thu Apr 19 18:08:33 2018
@@ -85,7 +85,7 @@ public class Converters implements Conve
         String del = "";
         for (String s : list)
         {
-            sb.append(del + getShortName(s));
+            sb.append(del).append(getShortName(s));
             del = " | ";
         }
         return sb;

Modified: felix/trunk/gogo/shell/src/main/java/org/apache/felix/gogo/shell/History.java
URL: http://svn.apache.org/viewvc/felix/trunk/gogo/shell/src/main/java/org/apache/felix/gogo/shell/History.java?rev=1829594&r1=1829593&r2=1829594&view=diff
==============================================================================
--- felix/trunk/gogo/shell/src/main/java/org/apache/felix/gogo/shell/History.java (original)
+++ felix/trunk/gogo/shell/src/main/java/org/apache/felix/gogo/shell/History.java Thu Apr 19 18:08:33 2018
@@ -36,7 +36,7 @@ public class History {
 
     public History() {
         this.limit = SIZE_DEFAULT;
-        this.commands = new LinkedList<String>();
+        this.commands = new LinkedList<>();
     }
 
     CharSequence evaluate(final CharSequence commandLine) {

Modified: felix/trunk/gogo/shell/src/main/java/org/apache/felix/gogo/shell/Posix.java
URL: http://svn.apache.org/viewvc/felix/trunk/gogo/shell/src/main/java/org/apache/felix/gogo/shell/Posix.java?rev=1829594&r1=1829593&r2=1829594&view=diff
==============================================================================
--- felix/trunk/gogo/shell/src/main/java/org/apache/felix/gogo/shell/Posix.java (original)
+++ felix/trunk/gogo/shell/src/main/java/org/apache/felix/gogo/shell/Posix.java Thu Apr 19 18:08:33 2018
@@ -149,7 +149,7 @@ public class Posix
                 {
                     line++;
                     Matcher matcher = pattern.matcher(s);
-                    if (!(matcher.find() ^ !opt.isSet("invert-match")))
+                    if (matcher.find() == !opt.isSet("invert-match"))
                     {
                         match = true;
                         if (opt.isSet("quiet"))
@@ -183,15 +183,10 @@ public class Posix
 
     public static void copy(URI source, OutputStream out) throws IOException
     {
-        InputStream in = source.toURL().openStream();
-        try
+        try (InputStream in = source.toURL().openStream())
         {
             copy(in, out);
         }
-        finally
-        {
-            in.close();
-        }
     }
 
     public static void copy(InputStream in, OutputStream out) throws IOException

Modified: felix/trunk/gogo/shell/src/main/java/org/apache/felix/gogo/shell/Procedural.java
URL: http://svn.apache.org/viewvc/felix/trunk/gogo/shell/src/main/java/org/apache/felix/gogo/shell/Procedural.java?rev=1829594&r1=1829593&r2=1829594&view=diff
==============================================================================
--- felix/trunk/gogo/shell/src/main/java/org/apache/felix/gogo/shell/Procedural.java (original)
+++ felix/trunk/gogo/shell/src/main/java/org/apache/felix/gogo/shell/Procedural.java Thu Apr 19 18:08:33 2018
@@ -32,8 +32,8 @@ public class Procedural
     public List<Object> each(CommandSession session, Collection<Object> list,
         Function closure) throws Exception
     {
-        List<Object> args = new ArrayList<Object>();
-        List<Object> results = new ArrayList<Object>();
+        List<Object> args = new ArrayList<>();
+        List<Object> results = new ArrayList<>();
         args.add(null);
 
         for (Object x : list)
@@ -97,8 +97,7 @@ public class Procedural
             throw new IllegalArgumentException("exception not set or not Throwable.");
     }
 
-    public Object _try(CommandSession session, Function func) throws Exception
-    {
+    public Object _try(CommandSession session, Function func) {
         try
         {
             return func.execute(session, null);
@@ -150,7 +149,7 @@ public class Procedural
             return false;
 
         if (result instanceof Boolean)
-            return ((Boolean) result).booleanValue();
+            return (Boolean) result;
 
         if (result instanceof Number)
         {
@@ -161,10 +160,7 @@ public class Procedural
         if ("".equals(result))
             return false;
 
-        if ("0".equals(result))
-            return false;
-
-        return true;
+        return !"0".equals(result);
     }
     
     private void checkInterrupt() throws InterruptedException

Modified: felix/trunk/gogo/shell/src/main/java/org/apache/felix/gogo/shell/Shell.java
URL: http://svn.apache.org/viewvc/felix/trunk/gogo/shell/src/main/java/org/apache/felix/gogo/shell/Shell.java?rev=1829594&r1=1829593&r2=1829594&view=diff
==============================================================================
--- felix/trunk/gogo/shell/src/main/java/org/apache/felix/gogo/shell/Shell.java (original)
+++ felix/trunk/gogo/shell/src/main/java/org/apache/felix/gogo/shell/Shell.java Thu Apr 19 18:08:33 2018
@@ -241,10 +241,8 @@ public class Shell
 
         URLConnection conn = script.toURL().openConnection();
 
-        InputStreamReader in = null;
-        try
+        try (InputStreamReader in = new InputStreamReader(conn.getInputStream()))
         {
-            in = new InputStreamReader(conn.getInputStream());
             while (in.read(buf) > 0)
             {
                 buf.flip();
@@ -258,10 +256,6 @@ public class Shell
             {
                 ((HttpURLConnection) conn).disconnect();
             }
-            if (in != null)
-            {
-                in.close();
-            }
         }
 
         return sb;
@@ -294,7 +288,7 @@ public class Shell
     public String[] history()
     {
         Iterator<String> history = this.history.getHistory();
-        List<String> lines = new ArrayList<String>();
+        List<String> lines = new ArrayList<>();
         for (int i = 1; history.hasNext(); i++)
         {
             lines.add(String.format("%5d  %s", i, history.next()));

Modified: felix/trunk/gogo/shell/src/main/java/org/apache/felix/gogo/shell/Telnet.java
URL: http://svn.apache.org/viewvc/felix/trunk/gogo/shell/src/main/java/org/apache/felix/gogo/shell/Telnet.java?rev=1829594&r1=1829593&r2=1829594&view=diff
==============================================================================
--- felix/trunk/gogo/shell/src/main/java/org/apache/felix/gogo/shell/Telnet.java (original)
+++ felix/trunk/gogo/shell/src/main/java/org/apache/felix/gogo/shell/Telnet.java Thu Apr 19 18:08:33 2018
@@ -139,31 +139,27 @@ public class Telnet implements Runnable
                 final CommandSession session = processor.createSession(
                     socket.getInputStream(), out, out);
 
-                Thread handler = new Thread()
-                {
-                    public void run()
+                Thread handler = new Thread(() -> {
+                    try
                     {
+                        session.execute("gosh --login --noshutdown");
+                    }
+                    catch (Exception e)
+                    {
+                        e.printStackTrace();
+                    }
+                    finally
+                    {
+                        session.close();
                         try
                         {
-                            session.execute("gosh --login --noshutdown");
-                        }
-                        catch (Exception e)
-                        {
-                            e.printStackTrace();
+                            socket.close();
                         }
-                        finally
+                        catch (IOException e)
                         {
-                            session.close();
-                            try
-                            {
-                                socket.close();
-                            }
-                            catch (IOException e)
-                            {
-                            }
                         }
                     }
-                };
+                });
                 handler.start();
             }
         }