Nested generics -- confusing

Why does the commented line not compile? Why does it need the extra specialization?
public class D<E>
    public M1<M2<E>> foo() { return null; }
    public M2<E> bar() { return null; }
    public static void f1()
        D<String>d = null;
        M2<String> m2 = d.bar();
        M1<M2<String>> m1 = d.foo();
    public static void f2()
        D<? extends String>d = null;
        M2<? extends String> m2 = d.bar();
        //M1<M2<? extends String>> m1 = d.foo(); // doesn't work!                                               
        M1<? extends M2<? extends String>> m1 = d.foo();
class M1<T>{}
class M2<S>{}

It does a good job of preventing this sort of trickery.
    public static void f2()
        D<? extends Number>d = null;
        class M3 extends M2<Double> {}
        // M1<M2<? extends Number>> m1 = new M1<M3>();
        M1<? extends M2<? extends Number>> m1 = new M1<M3>();
    }Or, for a more concrete example:
class D<E>
    List<List<E>> woo = new LinkedList<List<E>>();
    public List<List<E>> foo() {
         return woo;
    public void bar(List<E> list) {
         woo.add(list);
    public static void f2() {
        D<Double> d = new D<Double>();
        d.bar(new DoubleList());
        D<? extends Number> e = d;
        //List<List<? extends Number>> m1 = d.foo();
        List<? extends List<? extends Number>> m2 = d.foo();
class DoubleList extends LinkedList<Double> {}I haven't been able to find anything that would actually break type-safety if that were allowed, but this comes close, I think.

Similar Messages

  • Nested-Generic Type with the same parameter as enclosing type?

    Greetings. I want to write a nested generic type with the same type parameter as the enclosing type. For example, consider:
    public interface BinaryTree<Type> {
         Node<Type> getRoot();
         interface Node<Type> {
              Type getValue();
              void setValue(Type value);
              Node<Type> getLeft();
              void setLeft(Node<Type> node);
              Node<Type> getRight();
              void setRight(Node<Type> node);
    }In this example, I want Node to be specified to the same type as the binary tree's parameter specification. Does anyone know how to do that? I have tried several methods and am at a loss.
    TIA

    Is there any way to declare that? Essentially I want
    the nested type to parameterize the enclosing type.I understand that but I don't think it's possible because of how java generics works.
    This ,
    SomeClass< SomeNestedClass<Type> >is wrong because you're supposed to give a formal type parameter within <> not an already defined type (like SomeNestedClass).
    If you instead do
    public class SomeClass<Type > {
        public static class SomeNestedClass<Type> {
    }To think of the two Type as the same formal type parameter is semantically incorrect. Both the outer type and the inner type must be able to participate in variable declarations "on their own". Say you do
    SomeClass<Integer> sc;Just because you did the above in which context is now SomeNestedClass supposed to be bound as SomeNestedClass<Integer>? To me this shows that SomeClass and SomeNestedClass cannot share the same formal type parameter.

  • Generics Confusion

    Hi all. I am well aware that you cannot create an array of generics in java. However, I am being confused by the compiler errors I get for the following code:
    import java.util.Queue;
    import java.util.LinkedList;
    public class TopologicalSorter<E extends Comparable>{
        private class TopSortCell{
            private int PredecessorCount;
            //private E element;
            //private LinkedList<E> predecessors;
        private TopSortCell[] Elements;
        private Queue<E> OutputQueue;
        public TopologicalSorter(int[] elements){
            this.Elements = new TopSortCell[elements.length]; //It complains here!
    }I am not creating an array of generics am I? At first I thought it was complaining because there were some Generic attributes in my inner class so I commented them out but it still complains. Also, initially, the constructor argument int[] elements was E[] elements. I changed it only for experimentation.
    I tested creating an array out of an inner class with the following, just to make sure I am not mistaken:
    public class InnerClassTest{
         private class InnerClass{
              int i;
         private InnerClass[] TestArray;
         public InnerClassTest(char[] foo){
              TestArray = new InnerClass[foo.length];
    }Compiles smoothly. What might I be missing here?
    Thank you very much!

    If you make TopSortCell static, it compiles fine. I've rarely if ever found a reason for a named nested class not to be static.
    As for why it doesn't compile in the non-static case, I don't know really. I guess it has something to do with the inner class only being defined in the context of an instance of the outer class.
        TopologicalSorter[] x = new TopologicalSorter[1];
        TopologicalSorter<String>[] y = new TopologicalSorter<String>[1];The first line is fine, but the second gives "generic array creation" error. I guess the non-static nested class is viewed as being equivalent to, or implying, the second for some reason.

  • Somewhat complicated nested generics question

    I have a slightly complicated generics question. I have some parameterized code that looks something like:
    public <T extends MyBaseObject> Map<String,T> loadObjectCache (Class<T> clazz) {
        // load objects of type T from somewhere (file, database, etc.)
        List<T> objs = loadObjects(clazz);
        // create map to store objects keyed by name
        Map<String,T> map = new HashMap<String,T>();
        for (T obj : objs) {
            map.put(obj.name(), obj);
        return map;
    public static void main (String[] args) {
        // load objects of type Foo (a subclass of MyBaseClass)
        Map<String,Foo> map = loadObjectCache(Foo.class);
        // retrieve a Foo by name
        Foo foo = map.get("bling");
    }This all works great, and the parameterization helps me avoid some annoying casts. Now let's suppose I want build these maps for multiple classes, and I want to create a second-order cache of objects: a Map which is keyed by Class and contains elements each of which is a Map as above (keyed by name, containing objects of the given class). So, I'd like to declare something like:
    Map<Class,Map<String,Object>> metaMap = new HashMap<Class,Map<String,Object>>();However, this doesn't quite work. The compiler complains about the following code added just before the return in loadObjectCache() because a Map<String,Foo> is not a subclass of a Map<String,Object>:
        metaMap.put(clazz, map);So, What I'd like is some way to make the above declaration of metaMap such that the objects in a given inner Map are checked to be of the same type as the Class used to store that Map in the meta-map, something like:
    Map<Class<T>,Map<String,T>> metaMap = new HashMap<Class<T>,Map<String,T>>();But this isn't quite right either. I don't want a Map that uses a particular Class as its key. Rather, I want a Map that uses multiple Class objects as keys, and the element stored for each is itself a Map containing objects of that type. I've tried a variety of uses of Object, wildcards, etc., and I'm stumped. I currently have the meta-map defined as:
    Map<Class,Map<String,?>> metaMap = new HashMap<Class,Map<String,?>>();Then in my new getObjectByName() method, I have to use an ugly cast which gives me a type safety warning:
    public <T> T getObjectByName (Class<T> clazz, String name) {
        Map<String,T> map = (Map<String,T>)metaMap.get(clazz);
        return map.get(name);
    }If anyone know how I should declare the meta-map or whether it's even possible to accomplish all this without casts or warnings, I would much appreciate it!
    Dustin

    Map<Class<?>,Map<String,?>> metaMap = new
    new HashMap<Class<?>,Map<String,?>>();
    public <T> T getObjectByName (Class<T> clazz,
    azz, String name) {
         Map<String,?> map = metaMap.get(clazz);
         return clazz.cast(map.get(name));
    }Cute. Of course, that's really only hiding the warning, isn't it?
    Also it doesn't generalize because there's no way to crete a type token for a parameterized class. So you can't use a paramterized class as a key, nor can you nest 3 Maps.
        public static <U> void main(String[] args) {
            MetaMap mm = new MetaMap();
            Appendable a = mm.getObjectByName(Appendable.class, "MyAppendable");
            Comparable<U> u = mm.getObjectByName(Comparable.class, "MyComparable"); //unchecked converstion :(
        }Hey, not to sound ungrateful though. The solution posed is very useful for a certain class of problem.

  • Generic Confusion

    I thought I understood generics but I've hit something of a block. I get a message saying:
    "The return type is incompatible with BibTeXFormat.getIgnoredFields()"
    The following code snipette is basically what causes the problem (I think!).
    class Entry {
        Map<KeyClass, ValueClass> data;
        ArrayList<KeyClass> getKeyList() {
            return new ArrayList<KeyClass>(data.keySet());
    class ExtEntry  extends Entry {
        Map<KeyClass, ValueClass> specialData;
        ArrayList<KeyClass> getSpecialKeyList() {
            return new ArrayList<KeyClass>(specialData.keySet());
        ArrayList<KeyClass> getNonspecialKeyList() {
            ArrayList<KeyClass> keys = getKeyList();
            keys.removeAll(getSpecialKeyList());
            return keys;
        }The error occurs in the getNonspecialKeyList() I know I'm doing something stupid but I just can't spot it.
    Thanks,
    J

    oops name change error that should be ExtEntry.getNonspecialFields()The compiler error is just that no line number or anything else...

  • Nested Generic Class

    Let me show a runing example:
    interface MyListSet <T extends Object,L extends List<T>> extends Set<L> {
         public void addToAll(T e);
    }Question is, is there any simpler way to write this, something like:
    interface MyListSet <L extends List<T extends Object>> extends Set<L> {
         public void addToAll(T e);
    }First example is used like this:
    MyListSet<Double,LinkedList<Double>> list;While second would be cleaner:
    MyListSet<LinkedList<Double>> list;I usually have more complicated types, something like
    Something<A,B,C,AndAlso<A,B.C>> varname;An I would preffer something like
    Something<AndAlso<A,B.C>> varname;Any help?

    Well, note that the a class declaring a concrete type <L extends List> could "doSomehing(L list)" taking advantage of extra methods not declared in the List interface.
    This problem arised me wen I started to write a package to manage Weighted Finite-State Automata (WFSA) for speech recognition. I realized that generics where really beautifull! I wrote (more or less):
    interface Named {public String getName();}
    interface State extends Named {}
    interface Symbol extends Named {}
    interface Transition <S extends State, Y extends Symbol> extends Named {
         public S getSource();
         public S getDestination();
         public Y getSymbol();
         public double getProbability();
    interface WFSA <S extends State,Y extends Symbol> extends Named {
         public Y getSymbolByName(String name);
         public S getIniState();
         public <T extends Transition<S,Y>> T[] getTrans(S state);
         public <T extends Transition<S,Y>> T[] getTrans(S state, Y Symbol);
    }Using the State,Symbol,Transition and WFSA interfaces, I could build a single decoder to manage many different kinds of models (Hidden MarkovModels, simple wfsa-s, Language Models...) that would implement the interface. And using Generics, there was no need to use any cast.
    I also realized that the interface could be extended to train the wfsa. In fact, the procedure to train any model is basically the same, because the basic idea is to maximice the probability of a set of obserbations. But now, the transition type MUST also be declared:
    interface NewWFSA <S extends State,Y extends Symbol,T extends Transition<S,Y>> extends Named {
         public Y getSymbolByName(String name);
         public S getIniState();
         public double getFinProb(S state);
         public T[] getTrans(S state);
         public T[] getTrans(S state, Y Symbol);
    interface TrainableWFSA <S extends State,Y extends Symbol,T extends Transition<S,Y>> extends NewWFSA<S,Y,T> {
         public void initTrainCounts();
         public void incrementTrainCount(T trans, double count);
         public void dumpTrainCounts();
    }The result is quite an ugly declaration of a model:
    class MyState implements State {
    class MySymbol implements Symbol {
    class MyTransition implements Transition<MyState,MySymbol> {
    class MyModel implements TrainableWFSA<MyState,MySymbol,MyTransition> {
    }And seems there is some redundancy, as "MyTransition" already defines what kind of State and Symbol I am using.
    Thanks a lot and forgive me for such a long post.
    Edited by: Txistulari on Nov 16, 2007 3:11 AM
    Edited by: Txistulari on Nov 16, 2007 3:13 AM

  • Nested Generics

    I'm trying out this generics example and I cannot get it to compile.
    Here's the error msg:
    Bound mismatch: The type SubB<SubA> is not a valid substitute for the bounded parameter <T extends B<? super A>> of the type X<T>
    class A {
         class SubA extends A {
         class B<T extends A> {
         class SubB<T extends A> extends B<T> {
         class X<T extends B<? super A>> {
    new X<SubB<SubA>>(); // compilation error

    SubB extends B... check. SubA is a superclass of A... nope.
    If your goal is simply to write some code which compiles (and I don't see any other possible purpose for that code) then try declaring X like this:
    class X<T extends B<? extends A>>

  • Question about nested generics

    The question is similar to jschmied70's post. But that thread is marked closed. So I start a new thread --
    Example:
    List<List<? extends Number>> a = null;
    List<List<Number>> b = null;
    a = b; // error
    List<List<Integer>> c = null;
    a = c; // error
    Now, we can change the definition of "a" to
    List<? extends List<? extends Number>> a = null;
    Then,
    List<List<Number>> b = null;
    a = b; // works
    List<List<Integer>> c = null;
    a = c; // works
    It seems "? extends List<? extends Number>" means "some fixed but unknown subtype of List with some fixed but unknown subtype of Number as a subtype" (as dannyyates mentioned).
    Now the question is where the behavior is documented, (in java specification, implementation, books, etc). Or we just get the idea based on experience. I searched by google, but found nothing unfortunately.
    Your input is greatly appreciated.
    Thanks,
    William

    Now the question is where the behavior is documentedIn the [Java Language Specification #4.5|http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html#4.5].
    Right where you would expect it.

  • What is the name of a nested parameterized type?

    The draft spec gives an example of a nested parameterized class Zipper<B> inside a parameterized class Seq<A>. In the sample code the nested type is refered to as Seq<String>.Zipper<Number>. Hence I concluded that the following should work either:
    package generics;
    public class RawTypes {
    private static class Outer<T> {
    public class NonstaticInner<T> {}
    public static void main(String[] args) {
    Outer[] x = new Outer<String>();
    Outer<String>.NonstaticInner<String> var = x.new NonstaticInner<String>();
    Instead the compiler complains:
    incompatible types
    found : generics.RawTypes.Outer.NonstaticInner<java.lang.String>
    required: generics.RawTypes.Outer<java.lang.String>.NonstaticInner<java.lang.String>
              Outer<String>.NonstaticInner<String> var = x.new NonstaticInner<String>();
    When I use the raw outer type the compiler is happy. Like in:
    Outer.NonstaticInner<String> var = x.new NonstaticInner<String>();
    But that is not what I want say.
    Why does this fail to compile? Because the outer class is a nested static class instead of a top-level class? That should not make a difference, I would think. What am I missing?
    Angelika

    I am quite surprised there is no reaction at your query.
    It made me so interested in the spec I downloaded it.
    At page 3 I read that no static meber could be parametrized.
    I think this makes the behaviour of the compiler correct.No, I don't think so. The spec says:
    "The scope of a type parameter is all of the declared class, except any static members or initializers, but including the type parameter section itself."
    The spec does not say that static members could not be parameterized. It just says that the type parameter of a generic class cannot be used in any static members of that generic class, be it a static method or a static initializer or the declaration of a static field or a nested static class.
    Stuff like this would be prohibited under the quoted wording:
    class X<T> {
    static T field;
    static T getField() { ... }
    static { T tmp; ... }
    static class Y { T t; }
    What I tried is not prohibited by anything in the spec, I believe. I simply defined a generic type (Outer) inside a nongeneric type (RawTypes):
    public class RawTypes {
    private static class Outer<T> {
    public class NonstaticInner<T> {}
    The weird thing is that the nested generic type RawTypes.Outer<T> behaves differently from a top-level generic type. Compare the above to the following:
    public class Outer<T> {
    public class NonstaticInner<T> {}
    According to the spec I would refer to the class nested into class Outer<T> as Outer<String>.NonstaticInner<Integer>, for instance. That's basically the example on page 4 of the spec, where they have a Seq<String>.Zipper<Number>.
    Why is the behavior entirely different when I want to refer to a class nested into RawTYpes.Outer<T>? Why can't I say RawTypes.Outer<String>.NonstaticInner<Integer>? Why do I have to name it RawTypes.Outer.NonstaticInner<Integer>? That does not make sense to me.
    A nested static type is like a top-level type, except that is has a name prefix. Why would that change with the addition of generics to the language?
    Outer.NonstaticInner<String> var = x.new
    NonstaticInner<String>();
    But that is not what I want say.What is it then that you want to say?
    Do you want to confine the valid values of var to outer classes parametrized with the
    String type? This will lead to problems (I think even with instances) as there is
    no specific type for a parametrized class.What error would you expect when a variable
    is passed having the correct "inner parameter type" but not the requested outer parameter type?I would expect the same error message that I would get when I assigned a Seq<String>.Zipper<Number> to a Seq<Integer>.Zipper<Number>. No?
    Maybe it's just a bug in the prototype compiler, but who can tell if the spec does not say much about nested types what their names would be.
    Angelika

  • List protection proxy

    Hello,
    I am trying to write a protection proxy that protects a List of items and am having a lot of trouble structuring it.
    This list should only ever contain objects of a certain type, Role, which can also be genericized. I am trying to do this in the class declaration:
    public RoleProxyList<Role<? extends Updateable>> implements ListBut I am getting a syntax error, ReferenceType1 expected instead. Obviously it doesn't like the nested generics, but I thought this was possible? Do I just define it as:
    public RoleProxyList<Role> implements List and then assume that the Role object used to define ProxyList object has already had its own generic applied?
    If anyone has ever used a protection proxy on a List, or knows where I could see a code example, I would appreciate it.

    Thank you, that worked.
    My next question involves how I am implementing the List methods. My class declaration is:
    public class RoleProxyList<T extends Role<? extends Updateable>> implements List<T> {Now, since this is a proxy, I have a real subject inside which is what is protected by the proxy. Its declared as:
    private List<T> list = null;In all of my implemented List methods, until I get the actual protection logic working on relevant methods, I am just delegating to the real subject. i.e:
         public T get(int index) {
              return list.get(index);
         }I guess my question is just a basic generics question. Is the type of T just carried down from the class declaration? I assumed that I would have to do something like this:
         public Role<? extends Updateable>  get(int index) {
              return list.get(index);
         }Obviously, that doesn't compile. Sorry, just a little confused on how generics work with implementing an interface. Is my declaration of the real subject inside correct?

  • Scoping error in prototype?

    I believe there are some scoping bugs in the 1.3 prototype compiler.
    First, note that this is illegal:
    class A { interface I {} }
    class B extends A implements I {}Although B inherits I, I is not in scope for the header of B.
    Next, consider
    class A { interface I {} }
    class B extends A implements A.I {}The compiler now accepts this example, since A is in scope, and A.I exists.
    Now, what about
    class A { interface I {} }
    class B extends A implements B.I {}This should also compile (for the same reason as the last example), but the prototype compiler rejects it saying I does not exist! This is the first bug.
    We move on to this example:
    class A { interface I {} }
    class B<T extends I> extends A {}The prototype compiler accepts this example. But remembering the first example, I is not yet in scope in the class header, so this should be rejected. Second bug.
    To make matters more confusing:
    class C<T> {
      class T {}
      T t;
    }What is the type of t? The prototype compiler accepts this, and gives it type Object (as the erasure of parameter T) rather than C.T.
    On the other hand,
    class C {
      <T> void m() {
        class T {}
        T t;
    }Again, what is the type of t? The prototype compiler rejects this, stating that local class T conflicts with method type parameter T. Based on consistency, either the previous example or this example has a bug. I would prefer that the previous example be a compile error like this example is; if a type parameter and nested type share the same scope, they should not share the same name.

    Since people from Sun never do comment here, I suggest you keep experimenting, find as much as you can, and then file a real bug report.I have been experimenting with nested generic types quite a bit and the result is frustrating. Since the spec has barely anything to say about nested generic types, it is close to impossible to judge whether any dubious behavior is a bug or intended behavior. How do you want to file a bug report if there is no spec to compare against?
    I'm refering to the Participant Draft Specification of April 27, 2001 that comes with the early access release that is available for download. Is there a final spec that is more complete than the draft? I would be thankful if someone could point me to that document.
    For instance, the draft spec says: "The erasure of a nested type T.C is |T|.C."
    Aha! And what is the erasure of a parameterized type inside a parameterized type? From the draft spec I cannot tell whether the erasure of T<T1,...,Tn>.C<S1,...,Sn> is T.C<S1,...,Sn> or T.C. According to the wording of the spec is must be the former (since C is not required to be a non-parameterized type), but intuitively I would think it is the latter. However, the spec does not say that translation of types is performed recursively. It does not say anything.
    Also, if you file a bug report, the bugs are occasionally rejected as "not a bug" refering to statements in the spec that I cannot find in the spec. See for instance http://developer.java.sun.com/developer/bugParade/bugs/4482981.html
    It reports problems with nested interfaces inside a generic class. Instead of Outer<T>.InnerInterface, which would be the intuitive name for an interface inside a parameterized class, you have to use the raw outer type, namely Outer.InnerInterface.
    The reasoning was: "The spec says that static members need to be qualified with unparameterized types. Since interfaces are static, they fall under that rule." Fair enough, but the draft spec does not state anything like that.
    Here is another riddle:
    public final class BridgeMethods {
         private static class X<T> {
              public class Y<T> {}
         private static
         <T extends X<T>.Y<T>> T f(T arg) {return arg;}
         public static void main(String[] args) {
              X<String> x = new X<String>();
              X<String>.Y<String> y = f(x.new Y<String>());
    The error message is to the call of method f: f<T extends generics.BridgeMethods.X<T>.Y<T>>(T) in generics.BridgeMethods cannot be applied to (generics.BridgeMethods.X<java.lang.String>.Y<java.lang.String>)
    That does not make any sense to me. But frankly said, I have no idea whether this is my misconception or a compiler bug. I cannot find any justification for this error message in the draft spec. Does anybody have an idea why this compiler message would make sense?

  • List List ? extends T cannot be assigned to List List T , why?

    Can someone help we with why this fails to compile?
         List<List<? extends DrawableTile>> tiles;
         public TilePanel() {
              // This fails to compile:
              tiles = loadTestTiles();
         private static List<List<DrawableTile>> loadTestTiles() {
         }I know that this (below) works, but why not for the nested generics case?
    List<? extends DrawableTile> tileList = new ArrayList<DrawableTile>();

    List<DrawableTile> is a different type than List<? extends DrawableTile>. List of one type parameter cannot be assigned to List of another type parameter.
    Suppose you try to add a List<SubTypeOfDrawableTile> to tiles; it would work. But then suppose that the reference returned by loadTestTiles() was stored somewhere else as a List<List<DrawableTile>>. Then you would expect to be able to retrieve List<DrawableTile> out of it. Well now suppose you try to add a DrawableTile to that sublist. See the problem?
    You probably meant to do this
    List<? extends List<? extends DrawableTile>> tiles;Edited by: spoon_ on Dec 10, 2007 5:02 PM

  • Need 3rd level for ul menu

    The following code is for my pop out side menu. I need three levels and can only get two to work. The third level is under "Protective Clothing". Thanks for any help.
    <div id="menu">
        <ul>
         <ul>
          <li><a href="first_aid.html" title="First Aid">&raquo; First Aid</a>
            <ul>
              <li><a href="biohazard.html" title="Biohazard">Biohazard</a></li>
              <li><a href="burn.html" title="Burn Relief">Burn Relief</a></li>
              <li><a href="cpr_firstaid.html" title="whatever:hover file">CPR First Aid</a></li>
              <li><a href="eyewash.html" title="Emergency Eye Wash/Showers">Emergency Eye Wash/Showers</a></li>
              <li><a href="fa_kits_cabs.html" title="First Aid Kits & Cabinets">First Aid Kits & Cabinets</a></li>
              <li><a href="instruments.html" title="Instruments">Instruments</a></li>
              <li><a href="bandages.html" title="Bandages">Bandages</a></li>
              <li><a href="tablets.html" title="First Aid Tablets">First Aid Tablets</a></li>
              <li><a href="topicalsl.html" title="Topicals">Topicals</a></li>
              <li><a href="heat_stress.html" title="Heat Stress Relief">Heat Stress Relief</a></li>
              <li><a href="outdoor_exp.html" title="Outdoor Exposure">Outdoor Exposure</a></li>
              <li><a href="pest_control.html" title="Pest Control">Pest Control</a></li>
            </ul>
          </li>
          <li><a href="aed.html" title="AED's/Defibrillators">&raquo; AED's/Defibrillators</a>
            <ul>
             <li><a href="aed_philips.html">Philips</a></li>
              <li><a href="aed_cardiac_science.html" title="Cardiac Science">Cardiac Science</a></li>
              <li><a href="aed_zoll.html" title="Zoll">Zoll</a></li>
              <li><a href="aed_heartsine.html" title="HeartSine">HeartSine</a></li>
              <li><a href="aed_defibtech.html" title="Defibtech">Defibtech</a></li>
            </ul>
          </li>
          <li><a href="emerg_prepared.html" title="Emergency Preparednes">&raquo; Emergency Preparedness</a>
            <ul>
             <li><a href="aed_philips.html" title="AEDs">AEDs</a></li>
              <li><a href="emerg_oxygen.html" title="Emergency Oxygen">Emergency Oxygen</a></li>
              <li><a href="trauma_bags.html" title="Trauma Bags & Back Packs">Trauma Bags & Back Packs</a></li>
              <li><a href="back_boards.html" title="Back Board">Back Boards</a></li>
              <li><a href="pandemic_flu.html" title="Pandemic Flu">Pandemic Flu</a></li>
              <li><a href="terrorism.html" title="Terrorism">Terrorism</a></li>
              <li><a href="roadside_kits.html" title="Roadside Kits">Roadside Kits</a></li>
              <li><a href="eid.html" title="EID">EID</a></li>
              <li><a href="instruments.html" title="Instruments & Personal Items">Instruments & Personal Items</a></li>
            </ul>
          </li>
          <li><a href="pers_safety.html" title="Personal Safety">&raquo; Personal Safety</a>
            <ul>
              <li><a href="comm_sys.html" title="Communication Systems">Communication Systems</a></li>
              <li><a href="con_space.html" title="Confined Space">Confined Space</a></li>
              <li><a href="ergonomics.html" title="Ergonomics">Ergonomics</a></li>
              <li><a href="eye_pro.html" title="Eye Protection">Eye Protection</a></li>
              <li><a href="fall_pro.html" title="Fall Protection">Fall Protection</a></li>
              <li><a href="foot_pro.html" title="Foot Protection">Foot Protection</a></li>
              <li><a href="chemResist.html" title="Gloves">Gloves</a></li>
              <li><a href="hand_face_pro.html" title="Hand & Face Protection">Hand & Face Protection</a></li>
              <li><a href="hearing_pro.html" title="Hearing Protection">Hearing Protection</a></li>
              <li><a href="pro_clothing.html" title="Protective Clothing">Protective Clothing</a></li>
                          <ul>
                              <li><a href="hi_vis.html" id="hi_vislink" title="High Visability Safety Apparel">&raquo; High                              Visability Safety Apparel</a></li>
                              <li><a href="rainwear.html"id="rainwearlink" title="Rainwear">&raquo; Rainwear</a></li>
                              <li><a href="dis_wear.html" id="dis_wearlink" title="Disposable Wear">&raquo; Disposable Wear</a></li>
                              <li><a href="services.html" title="Services">&raquo; Training & Services</a></li>
                          </ul>
             <li><a href="resp_pro.html" title="Respiratory Protection">Respiratory Protection</a></li>
           </ul>
          </li>
           <li><a href="signs.html" title="Signs & Shipping Supplies">&raquo; Signs & Shipping Supplies</a>
            <ul>
              <li><a href="signs.html" title="Signs">Signs</a></li>
              <li><a href="shipping.html" title="Shipping Supplies">Shipping Supplies</a></li>
            </ul>
          </li>
                <li><a href="safety_maint.html" title="Safety Maintenance">&raquo Safety Maintenance</a>
            <ul>
              <li><a href="can_drum.html" title="Can & Drum Accessories">Can & Drum Accessories</a></li>
              <li><a href="electrical.html" title="Electrical Safety">Electrical Safety</a></li>
              <li><a href="equip_cases.html" title="Equipment Cases">Equipment Cases</a></li>
              <li><a href="fire.html" title="Fire Safety">Fire Safety</a></li>
              <li><a href="floor.html" title="Floor Matting">Floor Matting</a></li>
              <li><a href="lock_out.html" title="Lockout Tagout & Security">Lockout Tagout & Security</a></li>
              <li><a href="mirrors.html" title="Safety & Security Mirror">Safety & Security Mirrors</a></li>
              <li><a href="cabinets.html" title="Safety Cabinets">Safety Cabinets</a></li>
              <li><a href="cans.html" title="Safety Cans">Safety Cans</a></li>
              <li><a href="contain.html" title="Secondary Containment">Secondary Containment</a></li>
              <li><a href="sorbents.html" title="Sorbents & Spill Control">Sorbents & Spill Control</a></li>
              <li><a href="traffic.html" title="Traffic Safety Supplies">Traffic Safety Supplies</a></li>
              <li><a href="training.html" title="Training Programs">Training Programs</a></li>
            </ul>
          </li>
           <li><a href="janitorial.html" title="Janitorial">&raquo; Janitorial, Paper & Soap</a>
            <ul>
              <li><a href="cigarette.html" title="Cigarette Recepticles & Butt Cans">Cigarette Recepticles & Butt Cans</a></li>
              <li><a href="cleaning.html" title="Cleaning Products">Cleaning Products</a></li>
              <li><a href="paper_soap.html" title="Paper & Soap">Paper & Soap</a></li>
              <li><a href="waste.html" title="Waste & Recycling Containers">Waste & Recycling Containers</a></li>
              <li><a href="wipers_rags.html" title="Wipers & Rag">Wipers & Rags</a></li>
            </ul>
          </li>
          <li><a href="services.html" title="Services">&raquo; Training & Services</a></li>
       </ul>
      </li>
    </ul>
    </div><!--end menu-->

    <li><a href="pro_clothing.html" title="Protective Clothing">Protective Clothing</a></li>(this)
                          <ul>
                              <li><a href="hi_vis.html" id="hi_vislink" title="High Visability Safety Apparel">&raquo; High Visability Safety Apparel</a></li>
                              <li><a href="rainwear.html"id="rainwearlink" title="Rainwear">&raquo; Rainwear</a></li>
                              <li><a href="dis_wear.html" id="dis_wearlink" title="Disposable Wear">&raquo; Disposable Wear</a></li>
                              <li><a href="services.html" title="Services">&raquo; Training & Services</a></li>
                          </ul>(here?)
             <li><a href="resp_pro.html" title="Respiratory Protection">Respiratory Protection</a></li>
    You must allow for the possibility that I might be wrong here but I'll have a go anyway.  These nested lists confuse the heck out of me, but I'm wondering if that red <li> is in the wrong place and should be after the blue </ul>
    It wouldn't take you much effort to test that out but if I have made you too cautious, there's a chance that someone will maybe correct us both?
    All the best
    Martin
    [Edit] On my IE browser my color edits did not work so I made them bold and a bit bigger.  Hope that works! - and added words!

  • Confused about creation of inner class object of a generic class

    Trying to compile to code below I get three different diagnostic messages using various compilers: javac 1.5, javac 1.6 and Eclipse compiler. (On Mac OS X).
    class A<T> {
        class Nested {}
    public class UsesA <P extends A<?>> {
        P pRef;
        A<?>.Nested  f() {
            return pRef.new Nested();  // warning/error here
    Javac 1.5 outputs "UsesA.java:11: warning: [unchecked] unchecked conversion" warning, which is quite understandable. Javac 1.6 outputs an error message "UsesA.java:11: cannot select from a type variable", which I don't really undestand, and finally the Eclipse compiler gives no warning or error message at all. My question is, which compiler is right? And what does the message "cannot select from a type variable" means? "pRef", in the above code, is of a bounded type; why is the creation of an inner object not allowed?
    Next, if I change the type of "pRef" to be A<?>, javac 1.6 accepts the code with no error or warning message, while javac 1.5 gives an error message "UsesA.java:11: incompatible types" (concerning the return from "f" above). Similarly to javac 1.6, the Eclipse compiler issues no error message. So, is there something that has changed about generics in Java between versions 5 and 6 of the language?
    Thanks very much for any help

    Checkings bugs.sun.com, it seems to be a bug:
    http://bugs.sun.com/view_bug.do?bug_id=6569404

  • HS - Generic - Transparent Confusion

    I am attempting to connect to a SQL Server machine via Oracle 10gR1 on Windows.
    I think I am getting the differences between heterogeneous services, generic connectivity and transparent gateways confused - and as a result am mixing up my configurations.
    So far I have created a system DSN via the ODBC admin. called "oracletest". This DSN has been tested and is working just fine. Just in case it is important, it is using SQL Server Authentication.
    Then I created the $ORACLE_HOME/hs/admin/iniths_oracletest.ora file with the following entries:
    HS_FDS_CONNECT_INFO = oracletest
    HS_FDS_TRACE_LEVEL = OFF
    I then modified $ORACLE_HOME/network/admin/tnsnames.ora with
    ORACLETEST =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = ECYDBLCYADD01)(PORT = 1521))
    (CONNECT_DATA = (SID=oracletest)
    (HS = OK)
    and $ORACLE_HOME/network/admin/listener.ora with
    (SID_DESC =
         (PROGRAM = hsodbc)
    (ORACLE_HOME = e:\oracle\product\10.1.0\db_1)
    (SID_NAME = oracletest)
    I then bounced the listener and the database was registered. There was no registration of the oracletest entry. [Edit - the listener file was improperly named, once this was fixed the oracletest entry was registered at startup]
    In sqlplus I created a database link
    SQL> create databsase link oracletest using 'oracletest';
    SQL> select * from combined_cd@oracletest;
    ERROR at line 1:
    ORA-28545: error diagnosed by Net8 when connecting to an agent
    NCRO: Failed to make RSLV connection
    ORA-02063: preceding 2 lines from ORACLETEST
    I also changed $ORACLE_HOME/network/admin/sqlnet.ora
    to SQLNET.AUTHENTICATION_SERVICES= (NONE)
    from SQLNET.AUTHENTICATION_SERVICES= (NTS)
    I haven't found any errors in the listener.log
    I am guessing I am missing something small or have created some sort of vulcan mind meld of the different options that will never work.
    Message was edited by: T
    T

    T,
    For your information:
    'Hetrogenous Services' is the name of the system that allows an Oracle database to make SQL-like connections to non-Oracle systems. There are two types - 'Generic Connectivity' and 'Transparent Gateway'. 'Generic Connectivity' allows you to connect to ODBC and OleDB sources, and is provided as part of the database license and install. The 'Transparent Gateways' are built for specific systems (such as Sybase), and are licensed seperately. I think 'Generic Connectivity' used to be called 'Transparent Gateway for ODBC'.
    Your problem:
    I think the file in '$ORACLE_HOME/hs/admin/' should be named 'initoracletest.ora', not 'iniths_oracletest.ora'.
    Here is a guide to getting started with Generic Connectivity:
    http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:4406709207206#18830681837358
    Mr T :-)

Maybe you are looking for