Author: j16sdiz
Date: 2008-08-15 07:49:52 +0000 (Fri, 15 Aug 2008)
New Revision: 21884

Modified:
   trunk/freenet/src/freenet/clients/http/ConfigToadlet.java
   trunk/freenet/src/freenet/config/BooleanOption.java
   trunk/freenet/src/freenet/config/IntOption.java
   trunk/freenet/src/freenet/config/LongOption.java
   trunk/freenet/src/freenet/config/Option.java
   trunk/freenet/src/freenet/config/ShortOption.java
   trunk/freenet/src/freenet/config/StringArrOption.java
   trunk/freenet/src/freenet/config/StringOption.java
   trunk/freenet/src/freenet/config/SubConfig.java
Log:
generic-related warning hunt

Modified: trunk/freenet/src/freenet/clients/http/ConfigToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/ConfigToadlet.java   2008-08-15 
07:49:27 UTC (rev 21883)
+++ trunk/freenet/src/freenet/clients/http/ConfigToadlet.java   2008-08-15 
07:49:52 UTC (rev 21884)
@@ -123,7 +123,7 @@
                boolean logMINOR = Logger.shouldLog(Logger.MINOR, this);

                for(int i=0; i<sc.length ; i++){
-                       Option[] o = sc[i].getOptions();
+                       Option<?>[] o = sc[i].getOptions();
                        String prefix = sc[i].getPrefix();
                        String configName;

@@ -271,7 +271,7 @@
                for(int i=0; i<sc.length;i++){
                        short displayedConfigElements = 0;

-                       Option[] o = sc[i].getOptions();
+                       Option<?>[] o = sc[i].getOptions();
                        HTMLNode configGroupUlNode = new HTMLNode("ul", 
"class", "config");

                        for(int j=0; j<o.length; j++){
@@ -289,7 +289,7 @@
                                                continue;
                                        }

-                                       ConfigCallback callback = 
o[j].getCallback();
+                                       ConfigCallback<?> callback = 
o[j].getCallback();
                                        if(callback instanceof 
EnumerableOptionCallback)
                                                
configItemValueNode.addChild(addComboBox((EnumerableOptionCallback) callback, 
sc[i],
                                                        configName, 
callback.isReadOnly()));

Modified: trunk/freenet/src/freenet/config/BooleanOption.java
===================================================================
--- trunk/freenet/src/freenet/config/BooleanOption.java 2008-08-15 07:49:27 UTC 
(rev 21883)
+++ trunk/freenet/src/freenet/config/BooleanOption.java 2008-08-15 07:49:52 UTC 
(rev 21884)
@@ -6,7 +6,7 @@
 import freenet.l10n.L10n;
 import freenet.support.api.BooleanCallback;

-public class BooleanOption extends Option<Boolean, BooleanCallback> {
+public class BooleanOption extends Option<Boolean> {
        public BooleanOption(SubConfig conf, String optionName, boolean 
defaultValue, int sortOrder, 
                        boolean expert, boolean forceWrite, String shortDesc, 
String longDesc, BooleanCallback cb) {
                super(conf, optionName, cb, sortOrder, expert, forceWrite, 
shortDesc, longDesc, Option.DataType.BOOLEAN);

Modified: trunk/freenet/src/freenet/config/IntOption.java
===================================================================
--- trunk/freenet/src/freenet/config/IntOption.java     2008-08-15 07:49:27 UTC 
(rev 21883)
+++ trunk/freenet/src/freenet/config/IntOption.java     2008-08-15 07:49:52 UTC 
(rev 21884)
@@ -8,7 +8,7 @@
 import freenet.support.api.IntCallback;

 /** Integer config variable */
-public class IntOption extends Option<Integer, IntCallback> {
+public class IntOption extends Option<Integer> {
        public IntOption(SubConfig conf, String optionName, String 
defaultValueString, int sortOrder, boolean expert,
                boolean forceWrite, String shortDesc, String longDesc, 
IntCallback cb) {
                this(conf, optionName, Fields.parseInt(defaultValueString), 
sortOrder, expert, forceWrite, shortDesc, longDesc,

Modified: trunk/freenet/src/freenet/config/LongOption.java
===================================================================
--- trunk/freenet/src/freenet/config/LongOption.java    2008-08-15 07:49:27 UTC 
(rev 21883)
+++ trunk/freenet/src/freenet/config/LongOption.java    2008-08-15 07:49:52 UTC 
(rev 21884)
@@ -8,7 +8,7 @@
 import freenet.support.api.LongCallback;

 /** Long config variable */
-public class LongOption extends Option<Long, LongCallback> {
+public class LongOption extends Option<Long> {
        public LongOption(SubConfig conf, String optionName, String 
defaultValueString, int sortOrder, boolean expert,
                boolean forceWrite, String shortDesc, String longDesc, 
LongCallback cb) {
                this(conf, optionName, Fields.parseLong(defaultValueString), 
sortOrder, expert, forceWrite, shortDesc,

Modified: trunk/freenet/src/freenet/config/Option.java
===================================================================
--- trunk/freenet/src/freenet/config/Option.java        2008-08-15 07:49:27 UTC 
(rev 21883)
+++ trunk/freenet/src/freenet/config/Option.java        2008-08-15 07:49:52 UTC 
(rev 21884)
@@ -3,10 +3,11 @@
  * http://www.gnu.org/ for further details of the GPL. */
 package freenet.config;

+
 /**
  * A config option.
  */
-public abstract class Option<T, C extends ConfigCallback<T>> {
+public abstract class Option<T> {
        /** The parent SubConfig object */
        protected final SubConfig config;
        /** The option name */
@@ -22,7 +23,7 @@
        /** Long description of value e.g. "The TCP port to listen for FCP 
connections on" */
        protected final String longDesc;
        /** The configCallback associated to the Option */
-       protected final C cb;
+       protected final ConfigCallback<T> cb;

        protected T defaultValue;
        protected T currentValue;
@@ -34,7 +35,7 @@
        /** Data type : used to make it possible to make user inputs more 
friendly in FCP apps */
        final DataType dataType;

-       Option(SubConfig config, String name, C cb, int sortOrder, boolean 
expert, boolean forceWrite,
+       Option(SubConfig config, String name, ConfigCallback<T> cb, int 
sortOrder, boolean expert, boolean forceWrite,
                String shortDesc, String longDesc, DataType dataType) {
                this.config = config;
                this.name = name;
@@ -165,7 +166,7 @@
                return toString(defaultValue);
        }

-       public final C getCallback() {
+       public final ConfigCallback<T> getCallback() {
                return cb;
        }
 }

Modified: trunk/freenet/src/freenet/config/ShortOption.java
===================================================================
--- trunk/freenet/src/freenet/config/ShortOption.java   2008-08-15 07:49:27 UTC 
(rev 21883)
+++ trunk/freenet/src/freenet/config/ShortOption.java   2008-08-15 07:49:52 UTC 
(rev 21884)
@@ -4,7 +4,7 @@
 import freenet.support.Fields;
 import freenet.support.api.ShortCallback;

-public class ShortOption extends Option<Short, ShortCallback> {
+public class ShortOption extends Option<Short> {
        public ShortOption(SubConfig conf, String optionName, short 
defaultValue, int sortOrder, 
                        boolean expert, boolean forceWrite, String shortDesc, 
String longDesc, ShortCallback cb) {
                super(conf, optionName, cb, sortOrder, expert, forceWrite, 
shortDesc, longDesc, Option.DataType.NUMBER);

Modified: trunk/freenet/src/freenet/config/StringArrOption.java
===================================================================
--- trunk/freenet/src/freenet/config/StringArrOption.java       2008-08-15 
07:49:27 UTC (rev 21883)
+++ trunk/freenet/src/freenet/config/StringArrOption.java       2008-08-15 
07:49:52 UTC (rev 21884)
@@ -8,7 +8,7 @@
 import freenet.support.URLEncoder;
 import freenet.support.api.StringArrCallback;

-public class StringArrOption extends Option<String[], StringArrCallback> {
+public class StringArrOption extends Option<String[]> {
     public static final String delimiter = ";";

        public StringArrOption(SubConfig conf, String optionName, String[] 
defaultValue, int sortOrder, 

Modified: trunk/freenet/src/freenet/config/StringOption.java
===================================================================
--- trunk/freenet/src/freenet/config/StringOption.java  2008-08-15 07:49:27 UTC 
(rev 21883)
+++ trunk/freenet/src/freenet/config/StringOption.java  2008-08-15 07:49:52 UTC 
(rev 21884)
@@ -5,7 +5,7 @@

 import freenet.support.api.StringCallback;

-public class StringOption extends Option<String, StringCallback> {
+public class StringOption extends Option<String> {
        public StringOption(SubConfig conf, String optionName, String 
defaultValue, int sortOrder, 
                        boolean expert, boolean forceWrite, String shortDesc, 
String longDesc, StringCallback cb) {
                super(conf, optionName, cb, sortOrder, expert, forceWrite, 
shortDesc, longDesc, Option.DataType.STRING);

Modified: trunk/freenet/src/freenet/config/SubConfig.java
===================================================================
--- trunk/freenet/src/freenet/config/SubConfig.java     2008-08-15 07:49:27 UTC 
(rev 21883)
+++ trunk/freenet/src/freenet/config/SubConfig.java     2008-08-15 07:49:52 UTC 
(rev 21884)
@@ -24,7 +24,7 @@
  */
 public class SubConfig implements Comparable<SubConfig> {

-       private final LinkedHashMap<String, Option> map;
+       private final LinkedHashMap<String, Option<?>> map;
        public final Config config;
        final String prefix;
        private boolean hasInitialized;
@@ -32,7 +32,7 @@
        public SubConfig(String prefix, Config config) {
                this.config = config;
                this.prefix = prefix;
-               map = new LinkedHashMap<String, Option>();
+               map = new LinkedHashMap<String, Option<?>>();
                hasInitialized = false;
                config.register(this);
        }
@@ -41,15 +41,15 @@
         * Return all the options registered. Each includes its name.
         * Used by e.g. webconfig.
         */
-       public synchronized Option[] getOptions() {
+       public synchronized Option<?>[] getOptions() {
                return map.values().toArray(new Option[map.size()]);
        }

-       public synchronized Option getOption(String option){
+       public synchronized Option<?> getOption(String option) {
                return map.get(option);
        }

-       public void register(Option o) {
+       public void register(Option<?> o) {
                synchronized(this) {
                        if(o.name.indexOf(SimpleFieldSet.MULTI_LEVEL_CHAR) != 
-1)
                                throw new IllegalArgumentException("Option 
names must not contain "+SimpleFieldSet.MULTI_LEVEL_CHAR);
@@ -171,12 +171,12 @@
         * Set options from a SimpleFieldSet. Once we process an option, we 
must remove it.
         */
        public void setOptions(SimpleFieldSet sfs) {
-               Set<Map.Entry<String, Option>> entrySet = map.entrySet();
-               Iterator<Entry<String, Option>> i = entrySet.iterator();
+               Set<Map.Entry<String, Option<?>>> entrySet = map.entrySet();
+               Iterator<Entry<String, Option<?>>> i = entrySet.iterator();
                while(i.hasNext()) {
-                       Entry<String, Option> entry = i.next();
+                       Entry<String, Option<?>> entry = i.next();
                        String key = entry.getKey();
-                       Option o = entry.getValue();
+                       Option<?> o = entry.getValue();
                        String val = sfs.get(key);
                        if(val != null) {
                                try {
@@ -205,18 +205,19 @@

     public SimpleFieldSet exportFieldSet(Config.RequestType configRequestType, 
boolean withDefaults) {
                SimpleFieldSet fs = new SimpleFieldSet(true);
+               @SuppressWarnings("unchecked")
+               Map.Entry<String, Option<?>>[] entries = new 
Map.Entry[map.size()];
                // FIXME is any locking at all necessary here? After it has 
finished init, it's constant...
-               Map.Entry<String, Option>[] entries;
                synchronized(this) {
-                       entries = map.entrySet().toArray(new 
Map.Entry[map.size()]);
+                       entries = map.entrySet().toArray(entries);
                }
                boolean logMINOR = Logger.shouldLog(Logger.MINOR, this);
                if(logMINOR)
                        Logger.minor(this, "Prefix="+prefix);
                for(int i=0;i<entries.length;i++) {
-                       Map.Entry<String, Option> entry = entries[i];
+                       Map.Entry<String, Option<?>> entry = entries[i];
                        String key = entry.getKey();
-                       Option o = entry.getValue();
+                       Option<?> o = entry.getValue();
                        if(logMINOR)
                                Logger.minor(this, "Key="+key+" 
value="+o.getValueString()+" default="+o.isDefault());
                        if (configRequestType == 
Config.RequestType.CURRENT_SETTINGS && (!withDefaults) && o.isDefault()
@@ -267,12 +268,12 @@
         * @throws NodeNeedRestartException
         */
        public void forceUpdate(String optionName) throws 
InvalidConfigValueException, NodeNeedRestartException {
-               Option o = map.get(optionName);
+               Option<?> o = map.get(optionName);
                o.forceUpdate();
        }

        public void set(String name, String value) throws 
InvalidConfigValueException, NodeNeedRestartException {
-               Option o = map.get(name);
+               Option<?> o = map.get(name);
                o.setValue(value);
        }

@@ -289,7 +290,7 @@
         * @param value The value of the option.
         */
        public void fixOldDefault(String name, String value) {
-               Option o = map.get(name);
+               Option<?> o = map.get(name);
                if(o.getValueString().equals(value))
                        o.setDefault();
        }
@@ -302,7 +303,7 @@
         * @param value The value of the option.
         */
        public void fixOldDefaultRegex(String name, String value) {
-               Option o = map.get(name);
+               Option<?> o = map.get(name);
                if(o.getValueString().matches(value))
                        o.setDefault();
        }


Reply via email to