Modified: felix/trunk/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/Parser.java URL: http://svn.apache.org/viewvc/felix/trunk/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/Parser.java?rev=1736054&r1=1736053&r2=1736054&view=diff ============================================================================== --- felix/trunk/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/Parser.java (original) +++ felix/trunk/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/Parser.java Mon Mar 21 16:59:37 2016 @@ -20,7 +20,6 @@ package org.apache.felix.gogo.runtime; import java.util.ArrayList; import java.util.Collections; -import java.util.Comparator; import java.util.LinkedHashMap; import java.util.LinkedList; import java.util.List; @@ -174,9 +173,9 @@ public class Parser } protected final Tokenizer tz; - protected final LinkedList<String> stack = new LinkedList<String>(); - protected final List<Token> tokens = new ArrayList<Token>(); - protected final List<Statement> statements = new ArrayList<Statement>(); + protected final LinkedList<String> stack = new LinkedList<>(); + protected final List<Token> tokens = new ArrayList<>(); + protected final List<Statement> statements = new ArrayList<>(); public Parser(CharSequence line) { @@ -188,19 +187,13 @@ public class Parser } public List<Statement> statements() { - Collections.sort(statements, new Comparator<Statement>() { - public int compare(Statement o1, Statement o2) { - int x = o1.start(); - int y = o2.start(); - return (x < y) ? -1 : ((x == y) ? 0 : 1); - } - }); + Collections.sort(statements, (o1, o2) -> Integer.compare(o1.start, o2.start)); return Collections.unmodifiableList(statements); } public Program program() { - List<Executable> tokens = new ArrayList<Executable>(); + List<Executable> tokens = new ArrayList<>(); List<Executable> pipes = null; int start = tz.index - 1; while (true) @@ -313,13 +306,13 @@ public class Parser return new Closure(whole(start, end), program); } - private final Pattern redirNoArg = Pattern.compile("[0-9]?>&[0-9-]|[0-9-]?<&[0-9-]"); - private final Pattern redirArg = Pattern.compile("[0-9&]?>|[0-9]?>>|[0-9]?<|[0-9]?<>"); + private static final Pattern redirNoArg = Pattern.compile("[0-9]?>&[0-9-]|[0-9-]?<&[0-9-]"); + private static final Pattern redirArg = Pattern.compile("[0-9&]?>|[0-9]?>>|[0-9]?<|[0-9]?<>"); public Statement statement() { - List<Token> tokens = new ArrayList<Token>(); - List<Token> redirs = new ArrayList<Token>(); + List<Token> tokens = new ArrayList<>(); + List<Token> redirs = new ArrayList<>(); boolean needRedirArg = false; int start = tz.index; while (true) @@ -386,8 +379,8 @@ public class Parser { Token start = start("[", "array"); Boolean isMap = null; - List<Token> list = new ArrayList<Token>(); - Map<Token, Token> map = new LinkedHashMap<Token, Token>(); + List<Token> list = new ArrayList<>(); + Map<Token, Token> map = new LinkedHashMap<>(); while (true) { Token key = next(); @@ -495,7 +488,7 @@ public class Parser StringBuilder sb = new StringBuilder(); LinkedList<String> stack = this.stack; if (additional != null) { - stack = new LinkedList<String>(stack); + stack = new LinkedList<>(stack); stack.addLast(additional); } String last = null; @@ -572,25 +565,4 @@ public class Parser return tz.text.subSequence(b.start - tz.text.start, e.start + e.length() - tz.text.start); } - protected boolean isPiped(Token t) { - return Token.eq("|", t) || Token.eq("|&", t); - } - - /* - protected boolean isRedirection(Token t) { - return Token.eq("<", t) - || Token.eq("<>", t) - || Token.eq(">", t) - || Token.eq(">|", t) - || Token.eq(">!", t) - || Token.eq(">>", t) - || Token.eq(">>|", t) - || Token.eq(">>!", t) - || Token.eq("<<", t) - || Token.eq("<<-", t) - || Token.eq("<&", t.subSequence(0, 2)) && - || Token.eq("<&1", t) - - } - */ }
Modified: felix/trunk/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/Reflective.java URL: http://svn.apache.org/viewvc/felix/trunk/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/Reflective.java?rev=1736054&r1=1736053&r2=1736054&view=diff ============================================================================== --- felix/trunk/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/Reflective.java (original) +++ felix/trunk/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/Reflective.java Mon Mar 21 16:59:37 2016 @@ -37,7 +37,7 @@ public final class Reflective { public final static Object NO_MATCH = new Object(); public final static String MAIN = "_main"; - public final static Set<String> KEYWORDS = new HashSet<String>( + public final static Set<String> KEYWORDS = new HashSet<>( Arrays.asList(new String[] { "abstract", "continue", "for", "new", "switch", "assert", "default", "goto", "package", "synchronized", "boolean", "do", "if", "private", "this", "break", "double", "implements", "protected", @@ -50,10 +50,6 @@ public final class Reflective /** * invokes the named method on the given target using the supplied args, * which are converted if necessary. - * @param session - * @param target - * @param name - * @param args * @return the result of the invoked method * @throws Exception */ @@ -91,7 +87,7 @@ public final class Reflective Method bestMethod = null; Object[] bestArgs = null; int lowestMatch = Integer.MAX_VALUE; - ArrayList<Class<?>[]> possibleTypes = new ArrayList<Class<?>[]>(); + ArrayList<Class<?>[]> possibleTypes = new ArrayList<>(); for (Method m : methods) { @@ -100,7 +96,7 @@ public final class Reflective || mname.equals(is) || mname.equals(MAIN)) { Class<?>[] types = m.getParameterTypes(); - ArrayList<Object> xargs = new ArrayList<Object>(args); + ArrayList<Object> xargs = new ArrayList<>(args); // pass command name as argv[0] to main, so it can handle // multiple commands @@ -151,7 +147,7 @@ public final class Reflective } else { - ArrayList<String> list = new ArrayList<String>(); + ArrayList<String> list = new ArrayList<>(); for (Class<?>[] types : possibleTypes) { StringBuilder buf = new StringBuilder(); @@ -187,15 +183,13 @@ public final class Reflective * transform name/value parameters into ordered argument list. * params: --param2, value2, --flag1, arg3 * args: true, value2, arg3 - * @param method - * @param params * @return new ordered list of args. */ private static List<Object> transformParameters(Method method, List<Object> in) { Annotation[][] pas = method.getParameterAnnotations(); - ArrayList<Object> out = new ArrayList<Object>(); - ArrayList<Object> parms = new ArrayList<Object>(in); + ArrayList<Object> out = new ArrayList<>(); + ArrayList<Object> parms = new ArrayList<>(in); for (Annotation as[] : pas) { @@ -244,14 +238,8 @@ public final class Reflective * the arguments of the method call. First, an attempt is made to convert * each argument. If this fails, a check is made to see if varargs can be * applied. This happens when the last method argument is an array. - * - * @param session - * @param target - * @param m - * @param types - * @param out - * @param in - * @return -1 if arguments can't be coerced; 0 if no coercion was necessary; > 0 if coercion was needed. + * @return -1 if arguments can't be coerced; 0 if no coercion was necessary; + * > 0 if coercion was needed. */ private static int coerce(CommandSession session, Object target, Method m, Class<?> types[], Object out[], List<Object> in) @@ -342,9 +330,6 @@ public final class Reflective /** * converts given argument to specified type and increments convert[0] if any conversion was needed. - * @param session - * @param type - * @param arg * @param convert convert[0] is incremented according to the conversion needed, * to allow the "best" conversion to be determined. * @return converted arg or NO_MATCH if no conversion possible. @@ -441,7 +426,7 @@ public final class Reflective StringBuilder sb = new StringBuilder(); sb.append("["); boolean first = true; - for (Map.Entry<Object, Object> entry : ((Map<Object, Object>) arg).entrySet()) + for (Map.Entry<?,?> entry : ((Map<?,?>) arg).entrySet()) { if (!first) { sb.append(" "); Modified: felix/trunk/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/Tokenizer.java URL: http://svn.apache.org/viewvc/felix/trunk/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/Tokenizer.java?rev=1736054&r1=1736053&r2=1736054&view=diff ============================================================================== --- felix/trunk/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/Tokenizer.java (original) +++ felix/trunk/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/Tokenizer.java Mon Mar 21 16:59:37 2016 @@ -205,12 +205,4 @@ public class Tokenizer extends BaseToken this.pushed = token; } - public void skip(int length) - { - while (--length >= 0) - { - getch(); - } - } - } Modified: felix/trunk/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/activator/Activator.java URL: http://svn.apache.org/viewvc/felix/trunk/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/activator/Activator.java?rev=1736054&r1=1736053&r2=1736054&view=diff ============================================================================== --- felix/trunk/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/activator/Activator.java (original) +++ felix/trunk/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/activator/Activator.java Mon Mar 21 16:59:37 2016 @@ -78,8 +78,7 @@ public class Activator implements Bundle { threadio = new ThreadIOImpl(); threadio.start(); - threadioRegistration = context.registerService(ThreadIO.class.getName(), - threadio, null); + threadioRegistration = context.registerService(ThreadIO.class.getName(), threadio, null); processorRegistration = newProcessor(threadio, context); @@ -108,14 +107,16 @@ public class Activator implements Bundle listenerTracker = new ServiceTracker(context, CommandSessionListener.class.getName(), null) { @Override - public Object addingService(ServiceReference reference) { + public Object addingService(ServiceReference reference) + { CommandSessionListener listener = (CommandSessionListener) super.addingService(reference); processor.addListener(listener); return listener; } @Override - public void removedService(ServiceReference reference, Object service) { + public void removedService(ServiceReference reference, Object service) + { processor.removeListener((CommandSessionListener) service); super.removedService(reference, service); } @@ -143,7 +144,7 @@ public class Activator implements Bundle return new ServiceTracker(context, filter, null) { private final ConcurrentMap<ServiceReference, Map<String, CommandProxy>> proxies - = new ConcurrentHashMap<ServiceReference, Map<String, CommandProxy>>(); + = new ConcurrentHashMap<>(); @Override public Object addingService(ServiceReference reference) @@ -151,7 +152,7 @@ public class Activator implements Bundle Object scope = reference.getProperty(CommandProcessor.COMMAND_SCOPE); Object function = reference.getProperty(CommandProcessor.COMMAND_FUNCTION); Object ranking = reference.getProperty(Constants.SERVICE_RANKING); - List<Object> commands = new ArrayList<Object>(); + List<Object> commands = new ArrayList<>(); int rank = 0; if (ranking != null) @@ -167,7 +168,7 @@ public class Activator implements Bundle } if (scope != null && function != null) { - Map<String, CommandProxy> proxyMap = new HashMap<String, CommandProxy>(); + Map<String, CommandProxy> proxyMap = new HashMap<>(); if (function.getClass().isArray()) { for (Object f : ((Object[]) function)) Modified: felix/trunk/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/activator/EventAdminListener.java URL: http://svn.apache.org/viewvc/felix/trunk/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/activator/EventAdminListener.java?rev=1736054&r1=1736053&r2=1736054&view=diff ============================================================================== --- felix/trunk/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/activator/EventAdminListener.java (original) +++ felix/trunk/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/activator/EventAdminListener.java Mon Mar 21 16:59:37 2016 @@ -37,9 +37,11 @@ public class EventAdminListener implemen tracker.open(); } - public void beforeExecute(CommandSession session, CharSequence command) { + public void beforeExecute(CommandSession session, CharSequence command) + { EventAdmin admin = (EventAdmin) tracker.getService(); - if (admin != null) { + if (admin != null) + { Properties props = new Properties(); props.setProperty("command", command.toString()); Event event = new Event("org/apache/felix/service/command/EXECUTING", props); @@ -47,10 +49,12 @@ public class EventAdminListener implemen } } - public void afterExecute(CommandSession session, CharSequence command, Exception exception) { + public void afterExecute(CommandSession session, CharSequence command, Exception exception) + { } - public void afterExecute(CommandSession session, CharSequence command, Object result) { + public void afterExecute(CommandSession session, CharSequence command, Object result) + { } } Modified: felix/trunk/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/threadio/ThreadInputStream.java URL: http://svn.apache.org/viewvc/felix/trunk/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/threadio/ThreadInputStream.java?rev=1736054&r1=1736053&r2=1736054&view=diff ============================================================================== --- felix/trunk/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/threadio/ThreadInputStream.java (original) +++ felix/trunk/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/threadio/ThreadInputStream.java Mon Mar 21 16:59:37 2016 @@ -40,8 +40,6 @@ public class ThreadInputStream extends I /** * Access to the root stream through reflection - * - * @return */ public InputStream getRoot() { Modified: felix/trunk/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/threadio/ThreadPrintStream.java URL: http://svn.apache.org/viewvc/felix/trunk/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/threadio/ThreadPrintStream.java?rev=1736054&r1=1736053&r2=1736054&view=diff ============================================================================== --- felix/trunk/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/threadio/ThreadPrintStream.java (original) +++ felix/trunk/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/threadio/ThreadPrintStream.java Mon Mar 21 16:59:37 2016 @@ -44,8 +44,6 @@ public class ThreadPrintStream extends P /** * Access to the root stream through reflection - * - * @return */ public PrintStream getRoot() {
