From df9ff7f340a5ab4e07efc613f5f264eeae63d4c7 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Thu, 3 Jul 2014 16:06:47 +0200 Subject: Code Clean-Up based on our Recommended Settings (jogamp-scripting c47bc86ae2ee268a1f38c5580d11f93d7f8d6e74) Code Clean-Up based on our Recommended Settings (jogamp-scripting c47bc86ae2ee268a1f38c5580d11f93d7f8d6e74) - Change non static accesses to static members using declaring type - Change indirect accesses to static members to direct accesses (accesses through subtypes) - Add final modifier to private fields - Add final modifier to method parameters - Add final modifier to local variables - Remove unnecessary casts - Remove unnecessary '$NON-NLS$' tags - Remove trailing white spaces on all lines --- .../jogamp/android/launcher/ActivityLauncher.java | 26 +++++++++++----------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'src/java/jogamp/android/launcher/ActivityLauncher.java') diff --git a/src/java/jogamp/android/launcher/ActivityLauncher.java b/src/java/jogamp/android/launcher/ActivityLauncher.java index 72b7c0a..99bead8 100644 --- a/src/java/jogamp/android/launcher/ActivityLauncher.java +++ b/src/java/jogamp/android/launcher/ActivityLauncher.java @@ -48,7 +48,7 @@ public class ActivityLauncher extends Activity { Object activityObject = null; @Override - public void onCreate(Bundle savedInstanceState) { + public void onCreate(final Bundle savedInstanceState) { Log.d(TAG, "onCreate - S"); super.onCreate(savedInstanceState); @@ -57,7 +57,7 @@ public class ActivityLauncher extends Activity { data.setSystemProperties(); dataSet = true; - ClassLoader cl = ClassLoaderUtil.createClassLoader(this, data.getSysPackages(), data.getUsrPackages(), null); + final ClassLoader cl = ClassLoaderUtil.createClassLoader(this, data.getSysPackages(), data.getUsrPackages(), null); if(null != cl) { try { activityClazz = Class.forName(data.getActivityName(), true, cl); @@ -72,7 +72,7 @@ public class ActivityLauncher extends Activity { mSetRootActivity = activityClazz.getMethod("setRootActivity", Activity.class); activityObject = createInstance(activityClazz, null); Log.d(TAG, "Activity Object "+activityObject); - } catch (Exception e) { + } catch (final Exception e) { Log.d(TAG, "error: "+e, e); throw new RuntimeException(e); } @@ -81,7 +81,7 @@ public class ActivityLauncher extends Activity { if( null == mOnCreate || null == mOnDestroy || null == mOnPause || null == mOnRestart || null == mOnResume || null == mSetRootActivity ) { - RuntimeException e = new RuntimeException("XXX - incomplete method set"); + final RuntimeException e = new RuntimeException("XXX - incomplete method set"); Log.d(TAG, "error: "+e, e); throw e; } @@ -172,18 +172,18 @@ public class ActivityLauncher extends Activity { /** * @throws JogampRuntimeException if the instance can not be created. */ - public static final Object createInstance(Class clazz, Class[] cstrArgTypes, Object ... cstrArgs) + public static final Object createInstance(final Class clazz, final Class[] cstrArgTypes, final Object ... cstrArgs) throws RuntimeException { return createInstance(getConstructor(clazz, cstrArgTypes), cstrArgs); } - public static final Object createInstance(Constructor cstr, Object ... cstrArgs) + public static final Object createInstance(final Constructor cstr, final Object ... cstrArgs) throws RuntimeException { try { return cstr.newInstance(cstrArgs); - } catch (Exception e) { + } catch (final Exception e) { Throwable t = e; if (t instanceof InvocationTargetException) { t = ((InvocationTargetException) t).getTargetException(); @@ -201,22 +201,22 @@ public class ActivityLauncher extends Activity { /** * @throws JogampRuntimeException if the constructor can not be delivered. */ - protected static final Constructor getConstructor(Class clazz, Class ... cstrArgTypes) + protected static final Constructor getConstructor(final Class clazz, Class ... cstrArgTypes) throws RuntimeException { try { if(null == cstrArgTypes) { cstrArgTypes = zeroTypes; } return clazz.getDeclaredConstructor(cstrArgTypes); - } catch (NoSuchMethodException ex) { + } catch (final NoSuchMethodException ex) { throw new RuntimeException("Constructor: '" + clazz + "(" + asString(cstrArgTypes) + ")' not found", ex); } } protected static final Class[] zeroTypes = new Class[0]; - protected static final String asString(Class[] argTypes) { - StringBuilder args = new StringBuilder(); + protected static final String asString(final Class[] argTypes) { + final StringBuilder args = new StringBuilder(); boolean coma = false; if(null != argTypes) { for (int i = 0; i < argTypes.length; i++) { @@ -230,12 +230,12 @@ public class ActivityLauncher extends Activity { return args.toString(); } - protected static final Object callMethod(Object instance, Method method, Object ... args) + protected static final Object callMethod(final Object instance, final Method method, final Object ... args) throws RuntimeException { try { return method.invoke(instance, args); - } catch (Exception e) { + } catch (final Exception e) { Throwable t = e; if (t instanceof InvocationTargetException) { t = ((InvocationTargetException) t).getTargetException(); -- cgit v1.2.3