harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndbe...@apache.org
Subject svn commit: r771025 - in /harmony/enhanced/classlib/trunk/modules/lang-management/src: main/java/org/apache/harmony/lang/management/ test/api/java/org/apache/harmony/lang/management/tests/java/lang/management/ test/api/java/tests/java/util/logging/
Date Sun, 03 May 2009 05:18:26 GMT
Author: ndbeyer
Date: Sun May  3 05:18:25 2009
New Revision: 771025

URL: http://svn.apache.org/viewvc?rev=771025&view=rev
Log:
clean up compiler warnings; add some test assertions

Modified:
    harmony/enhanced/classlib/trunk/modules/lang-management/src/main/java/org/apache/harmony/lang/management/DynamicMXBeanImpl.java
    harmony/enhanced/classlib/trunk/modules/lang-management/src/main/java/org/apache/harmony/lang/management/ManagementUtils.java
    harmony/enhanced/classlib/trunk/modules/lang-management/src/main/java/org/apache/harmony/lang/management/OpenTypeMappingIHandler.java
    harmony/enhanced/classlib/trunk/modules/lang-management/src/test/api/java/org/apache/harmony/lang/management/tests/java/lang/management/CompilationMXBeanTest.java
    harmony/enhanced/classlib/trunk/modules/lang-management/src/test/api/java/org/apache/harmony/lang/management/tests/java/lang/management/ManagementFactoryTest.java
    harmony/enhanced/classlib/trunk/modules/lang-management/src/test/api/java/org/apache/harmony/lang/management/tests/java/lang/management/MemoryPoolMXBeanTest.java
    harmony/enhanced/classlib/trunk/modules/lang-management/src/test/api/java/org/apache/harmony/lang/management/tests/java/lang/management/MemoryUsage2Test.java
    harmony/enhanced/classlib/trunk/modules/lang-management/src/test/api/java/org/apache/harmony/lang/management/tests/java/lang/management/ThreadMXBeanTest.java
    harmony/enhanced/classlib/trunk/modules/lang-management/src/test/api/java/tests/java/util/logging/LoggingMXBeanTest.java

Modified: harmony/enhanced/classlib/trunk/modules/lang-management/src/main/java/org/apache/harmony/lang/management/DynamicMXBeanImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/lang-management/src/main/java/org/apache/harmony/lang/management/DynamicMXBeanImpl.java?rev=771025&r1=771024&r2=771025&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/lang-management/src/main/java/org/apache/harmony/lang/management/DynamicMXBeanImpl.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/lang-management/src/main/java/org/apache/harmony/lang/management/DynamicMXBeanImpl.java
Sun May  3 05:18:25 2009
@@ -222,7 +222,7 @@
         // collection types).
         // 3. all return null
 
-        Class argType = null;
+        Class<?> argType = null;
 
         // Validate the attribute
         MBeanAttributeInfo attribInfo = getPresentAttribute(
@@ -313,7 +313,7 @@
         // i.e. they are all simple types.
         Method operationMethod = null;
         try {
-            Class[] argTypes = new Class[localSignature.length];
+            Class<?>[] argTypes = new Class[localSignature.length];
             for (int i = 0; i < localSignature.length; i++) {
                 argTypes[i] = ManagementUtils
                         .getClassMaybePrimitive(localSignature[i]);

Modified: harmony/enhanced/classlib/trunk/modules/lang-management/src/main/java/org/apache/harmony/lang/management/ManagementUtils.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/lang-management/src/main/java/org/apache/harmony/lang/management/ManagementUtils.java?rev=771025&r1=771024&r2=771025&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/lang-management/src/main/java/org/apache/harmony/lang/management/ManagementUtils.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/lang-management/src/main/java/org/apache/harmony/lang/management/ManagementUtils.java
Sun May  3 05:18:25 2009
@@ -1430,9 +1430,9 @@
      *             if <code>name</code> does not correspond to any known type
      *             (including primitive types).
      */
-    public static Class getClassMaybePrimitive(String name)
+    public static Class<?> getClassMaybePrimitive(String name)
             throws ClassNotFoundException {
-        Class result = null;
+        Class<?> result = null;
 
         try {
             result = Class.forName(name);
@@ -1479,7 +1479,7 @@
      *         <code>false</code>.
      */
     public static boolean isWrapperClass(Class<? extends Object> wrapper,
-            Class primitive) {
+            Class<?> primitive) {
         boolean result = true;
         if (primitive.equals(boolean.class) && !wrapper.equals(Boolean.class)) {
             result = false;

Modified: harmony/enhanced/classlib/trunk/modules/lang-management/src/main/java/org/apache/harmony/lang/management/OpenTypeMappingIHandler.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/lang-management/src/main/java/org/apache/harmony/lang/management/OpenTypeMappingIHandler.java?rev=771025&r1=771024&r2=771025&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/lang-management/src/main/java/org/apache/harmony/lang/management/OpenTypeMappingIHandler.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/lang-management/src/main/java/org/apache/harmony/lang/management/OpenTypeMappingIHandler.java
Sun May  3 05:18:25 2009
@@ -387,10 +387,10 @@
      */
     private String[] getOperationSignature(Method method) {
         String[] result = null;
-        Class[] args = method.getParameterTypes();
+        Class<?>[] args = method.getParameterTypes();
         result = new String[args.length];
         for (int i = 0; i < args.length; i++) {
-            Class clazz = args[i];
+            Class<?> clazz = args[i];
             result[i] = clazz.getName();
         }
         return result;

Modified: harmony/enhanced/classlib/trunk/modules/lang-management/src/test/api/java/org/apache/harmony/lang/management/tests/java/lang/management/CompilationMXBeanTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/lang-management/src/test/api/java/org/apache/harmony/lang/management/tests/java/lang/management/CompilationMXBeanTest.java?rev=771025&r1=771024&r2=771025&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/lang-management/src/test/api/java/org/apache/harmony/lang/management/tests/java/lang/management/CompilationMXBeanTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/lang-management/src/test/api/java/org/apache/harmony/lang/management/tests/java/lang/management/CompilationMXBeanTest.java
Sun May  3 05:18:25 2009
@@ -54,7 +54,7 @@
             assertTrue(mb.getTotalCompilationTime() > -1);
         } else {
             try {
-                long tmp = mb.getTotalCompilationTime();
+                mb.getTotalCompilationTime();
                 fail("Should have thrown unsupported operation exception!");
             } catch (UnsupportedOperationException e) {
                 // ignore

Modified: harmony/enhanced/classlib/trunk/modules/lang-management/src/test/api/java/org/apache/harmony/lang/management/tests/java/lang/management/ManagementFactoryTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/lang-management/src/test/api/java/org/apache/harmony/lang/management/tests/java/lang/management/ManagementFactoryTest.java?rev=771025&r1=771024&r2=771025&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/lang-management/src/test/api/java/org/apache/harmony/lang/management/tests/java/lang/management/ManagementFactoryTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/lang-management/src/test/api/java/org/apache/harmony/lang/management/tests/java/lang/management/ManagementFactoryTest.java
Sun May  3 05:18:25 2009
@@ -203,7 +203,7 @@
 
         // MXBean name deliberately in wrong format
         try {
-            ClassLoadingMXBean proxy = ManagementFactory
+            ManagementFactory
                     .newPlatformMXBeanProxy(ManagementFactory
                             .getPlatformMBeanServer(),
                             "java,lang:type=ClassLoading",
@@ -214,7 +214,7 @@
 
         // MXBean name in correct format but deliberately bogus
         try {
-            ClassLoadingMXBean proxy = ManagementFactory
+            ManagementFactory
                     .newPlatformMXBeanProxy(ManagementFactory
                             .getPlatformMBeanServer(),
                             "java.lang:type=ClassStroking",
@@ -225,7 +225,7 @@
 
         // Named MXBean does not implement the supplied MXBean interface
         try {
-            ClassLoadingMXBean proxy = ManagementFactory
+            ManagementFactory
                     .newPlatformMXBeanProxy(ManagementFactory
                             .getPlatformMBeanServer(), "java.lang:type=Memory",
                             ClassLoadingMXBean.class);
@@ -238,7 +238,7 @@
                 .getMemoryPoolMXBeans();
         for (MemoryPoolMXBean bean : allMPoolBeans) {
             try {
-                ClassLoadingMXBean proxy = ManagementFactory
+                ManagementFactory
                         .newPlatformMXBeanProxy(ManagementFactory
                                 .getPlatformMBeanServer(), bean.getName(),
                                 ClassLoadingMXBean.class);
@@ -252,7 +252,7 @@
                 .getGarbageCollectorMXBeans();
         for (GarbageCollectorMXBean bean : allGCBeans) {
             try {
-                ThreadMXBean proxy = ManagementFactory.newPlatformMXBeanProxy(
+                ManagementFactory.newPlatformMXBeanProxy(
                         ManagementFactory.getPlatformMBeanServer(), bean
                                 .getName(), ThreadMXBean.class);
                 fail("should have thrown IllegalArgumentException");
@@ -265,7 +265,7 @@
                 .getMemoryManagerMXBeans();
         for (MemoryManagerMXBean bean : allMMBeans) {
             try {
-                ThreadMXBean proxy = ManagementFactory.newPlatformMXBeanProxy(
+                ManagementFactory.newPlatformMXBeanProxy(
                         ManagementFactory.getPlatformMBeanServer(), bean
                                 .getName(), ThreadMXBean.class);
                 fail("should have thrown IllegalArgumentException");
@@ -341,7 +341,6 @@
             String[] poolNames2 = proxy.getMemoryPoolNames();
             assertEquals(poolNames1.length, poolNames2.length);
             for (int i = 0; i < poolNames1.length; i++) {
-                String string = poolNames1[i];
                 assertEquals(poolNames1[i], poolNames2[i]);
             }
         }
@@ -374,7 +373,6 @@
                 String[] poolNames2 = proxy.getMemoryPoolNames();
                 assertEquals(poolNames1.length, poolNames2.length);
                 for (int i = 0; i < poolNames1.length; i++) {
-                    String string = poolNames1[i];
                     assertEquals(poolNames1[i], poolNames2[i]);
                 }
             }// end if memory manager is registered with server connection

Modified: harmony/enhanced/classlib/trunk/modules/lang-management/src/test/api/java/org/apache/harmony/lang/management/tests/java/lang/management/MemoryPoolMXBeanTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/lang-management/src/test/api/java/org/apache/harmony/lang/management/tests/java/lang/management/MemoryPoolMXBeanTest.java?rev=771025&r1=771024&r2=771025&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/lang-management/src/test/api/java/org/apache/harmony/lang/management/tests/java/lang/management/MemoryPoolMXBeanTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/lang-management/src/test/api/java/org/apache/harmony/lang/management/tests/java/lang/management/MemoryPoolMXBeanTest.java
Sun May  3 05:18:25 2009
@@ -70,7 +70,7 @@
                 assertTrue(mb.getCollectionUsageThreshold() > -1);
             } else {
                 try {
-                    long val = mb.getCollectionUsageThreshold();
+                    mb.getCollectionUsageThreshold();
                     fail("Should have thrown UnsupportedOperationException");
                 } catch (UnsupportedOperationException ignore) {
                 }
@@ -88,7 +88,7 @@
                 assertTrue(mb.getCollectionUsageThresholdCount() > -1);
             } else {
                 try {
-                    long val = mb.getCollectionUsageThresholdCount();
+                    mb.getCollectionUsageThresholdCount();
                     fail("Should have thrown UnsupportedOperationException");
                 } catch (UnsupportedOperationException ignore) {
                 }
@@ -194,7 +194,7 @@
                 assertTrue(mb.getUsageThreshold() > -1);
             } else {
                 try {
-                    long val = mb.getUsageThreshold();
+                    mb.getUsageThreshold();
                     fail("Should have thrown UnsupportedOperationException");
                 } catch (UnsupportedOperationException ignore) {
                 }
@@ -212,7 +212,7 @@
                 assertTrue(mb.getUsageThresholdCount() > -1);
             } else {
                 try {
-                    long val = mb.getUsageThresholdCount();
+                    mb.getUsageThresholdCount();
                     fail("Should have thrown UnsupportedOperationException");
                 } catch (UnsupportedOperationException ignore) {
                 }
@@ -228,10 +228,10 @@
         for (MemoryPoolMXBean mb : allBeans) {
             if (mb.isCollectionUsageThresholdSupported()) {
                 // Not a lot to test here. Maybe it will throw an exception ?
-                boolean val = mb.isCollectionUsageThresholdExceeded();
+                mb.isCollectionUsageThresholdExceeded();
             } else {
                 try {
-                    boolean val = mb.isCollectionUsageThresholdExceeded();
+                    mb.isCollectionUsageThresholdExceeded();
                     fail("Should have thrown UnsupportedOperationException");
                 } catch (UnsupportedOperationException ignore) {
                 }
@@ -246,10 +246,10 @@
     public void testIsUsageThresholdExceeded() {
         for (MemoryPoolMXBean mb : allBeans) {
             if (mb.isUsageThresholdSupported()) {
-                boolean value = mb.isUsageThresholdExceeded();
+                mb.isUsageThresholdExceeded();
             } else {
                 try {
-                    boolean value = mb.isUsageThresholdExceeded();
+                    mb.isUsageThresholdExceeded();
                     fail("Should have thrown UnsupportedOperationException");
                 } catch (UnsupportedOperationException ignore) {
                 }

Modified: harmony/enhanced/classlib/trunk/modules/lang-management/src/test/api/java/org/apache/harmony/lang/management/tests/java/lang/management/MemoryUsage2Test.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/lang-management/src/test/api/java/org/apache/harmony/lang/management/tests/java/lang/management/MemoryUsage2Test.java?rev=771025&r1=771024&r2=771025&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/lang-management/src/test/api/java/org/apache/harmony/lang/management/tests/java/lang/management/MemoryUsage2Test.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/lang-management/src/test/api/java/org/apache/harmony/lang/management/tests/java/lang/management/MemoryUsage2Test.java
Sun May  3 05:18:25 2009
@@ -59,7 +59,11 @@
         // negative but not -1
         MemoryUsage memUsage = new MemoryUsage(-1, GOOD_MU_USED_VAL,
                 GOOD_MU_COMMITTED_VAL, -1);
-
+        assertEquals(-1, memUsage.getInit());
+        assertEquals(GOOD_MU_USED_VAL, memUsage.getUsed());
+        assertEquals(GOOD_MU_COMMITTED_VAL, memUsage.getCommitted());
+        assertEquals(-1, memUsage.getMax());
+        
         try {
             memUsage = new MemoryUsage(-2, GOOD_MU_USED_VAL,
                     GOOD_MU_COMMITTED_VAL, -1);

Modified: harmony/enhanced/classlib/trunk/modules/lang-management/src/test/api/java/org/apache/harmony/lang/management/tests/java/lang/management/ThreadMXBeanTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/lang-management/src/test/api/java/org/apache/harmony/lang/management/tests/java/lang/management/ThreadMXBeanTest.java?rev=771025&r1=771024&r2=771025&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/lang-management/src/test/api/java/org/apache/harmony/lang/management/tests/java/lang/management/ThreadMXBeanTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/lang-management/src/test/api/java/org/apache/harmony/lang/management/tests/java/lang/management/ThreadMXBeanTest.java
Sun May  3 05:18:25 2009
@@ -220,7 +220,7 @@
         // Should throw exception if a Thread id of 0 or less is input
         try {
             long[] input = new long[] { 0 };
-            ThreadInfo[] tmp = mb.getThreadInfo(input);
+            mb.getThreadInfo(input);
             fail("Should have thrown an IllegalArgumentException");
         } catch (IllegalArgumentException ignore) {
         }
@@ -306,7 +306,7 @@
 
                 // Should throw a wobbler if a bad Thread id is passed in.
                 try {
-                    long tmp = mb.getThreadUserTime(-122);
+                    mb.getThreadUserTime(-122);
                     fail("Should have thrown an IllegalArgumentException!");
                 } catch (IllegalArgumentException ignore) {
                 }

Modified: harmony/enhanced/classlib/trunk/modules/lang-management/src/test/api/java/tests/java/util/logging/LoggingMXBeanTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/lang-management/src/test/api/java/tests/java/util/logging/LoggingMXBeanTest.java?rev=771025&r1=771024&r2=771025&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/lang-management/src/test/api/java/tests/java/util/logging/LoggingMXBeanTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/lang-management/src/test/api/java/tests/java/util/logging/LoggingMXBeanTest.java
Sun May  3 05:18:25 2009
@@ -70,6 +70,7 @@
             assertNotNull(level);
             if (level.length() > 0) {
                 Level l = Level.parse(level);
+                assertNotNull(l);
             }// end if not an empty string
         }// end while
     }



Mime
View raw message