Thread (13 messages) flat view 13 messages, 4 authors, 2016-06-15

Re: [PATCH] Require JDK1.5

From: Robin Rosenberg <hidden>
Date: 2016-06-15 22:43:10

måndag 14 maj 2007 skrev Noel Grandin:
quoted
quoted
diff --git
a/org.spearce.jgit/src/org/spearce/jgit/lib/ObjectIdMap.java
b/org.spearce.jgit/src/org/spearce/jgit/lib/ObjectIdMap.java
index c397a0d..63796fd 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/lib/ObjectIdMap.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/ObjectIdMap.java
@@ -50,9 +50,9 @@ public class ObjectIdMap implements Map {

    public ObjectIdMap(Map sample) {
        try {
-            Method m=sample.getClass().getMethod("clone", null);
+            Method m=sample.getClass().getMethod("clone",
(Class[])null);
            for (int i=0; i<256; ++i) {
-                level0[i] = (Map)m.invoke(sample, null);
+                level0[i] = (Map)m.invoke(sample, (Object[])null);
            }
        } catch (IllegalAccessException e) {
            throw new IllegalArgumentException(e);
I wonder why one would need changes like this?

These casts are not needed for anything as far as I can see and your
IDE should easily tell you what type that parameter is. No?
Those are varargs parameters, so when compiling under 1.5 you sometimes
have to tell the compiler the difference between passing a varargs array
and passing one parameter.
The compiler does the right thing by default in this case, but I don't
like seeing warnings for code that is perfectly fine, hence the cast.

I noticed I dropped using this class just before sending the previous set
of patches, so it isn't really necessary in the current code, but I think I will start 
using it soon so it can stay.

-- robin
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help