"Name Clash: Method in Two Classes Have Same Erasure, Yet Neither Over-..."

Ok, I'm getting this message when trying to compile the classes below: "FileUtils.java:1117: name clash: add(E) in java.util.ArrayList<java.util.LinkedList<F>> and add(T) in gov.sandia.gajanik.util.Addable<F> have the same erasure, yet neither overrides the other"
The funny thing is, they actually don't have the same erasure, from what I can see. In short, I have a class
class DuplicatesArrayList<F extends File> extends ArrayList<LinkedList<F>> implements Addable<F>Addable<T> has a method
public boolean add(T addMe);and, from the javadoc for jdk1.6.0, ArrayList<E>has a method
public boolean add(E e);But, note how ArrayList has the type parameter LinkedList<F> and Addable has the type parameter F. Given that, the erasures should be
public boolean add(LinkedList e);//Erasure of LinkedList<F>
public boolean add(File addMe);  //Erasure of FAm I missing something? Is it just the end of the day and my brain isn't working right? Help!

Actually, the ArrayList extension is the most critical part. The class I'm trying to make really is an ArrayList that has files added to it, but stores them in LinkedList (the context doing the adding decides when to delimit the files in LinkedLists). I came to this solution because I tried to designed the method that's actually using the ArrayList the take anything that it can "add" Files to and separate related groups of files. This way it can either use a collection-type class (what you've seen here) or a class that handles the files differently (I have one that prints them to System.out instead). I could require a collection, but then the method that is calling "add" also has to specify exactly how it groups related files together (which is less flexible), and callers must implement all the methods specified by the Collection interface (or have them throw something like an UnsupportedOperationException for everthing except "add"), even though all I need is "add".
I probably could make my own inheritance tree that would simply be a copy of that in java.util, starting at AbstractList. But I have qualms about copying Sun's source code (which is essentially what I would do) and then just add the few methods I need to their collection classes.
I'm interested to know how you would implement such a solution, if you would be kind enough to show me. Here's what I have:
* An interface that specifies an object that can have things added to (and thus
* processed by) it.</p>
* @param <T> The type processed by this {@code Addable}
public interface Addable<T> {
     * Ensures that this {@code Addable} takes appropriate action on the
     * specified object</p>
     * @param addMe The object to operate on
     * @return Whether or not the operation succeeded
    public boolean add(T addMe);
     * Ensures that this {@code Addable} takes appropriate action on all the
     * items returned by the iterator of the specified iterable object</p>
     * @param itr The object to get items from
     * @return The number of items successfully proccessed
    public int addAll(Iterable<T> itr);
    public static final class DefaultBehavior {
         * Ensures that this {@code Addable} takes appropriate action on all the
         * items returned by the iterator of the specified iterable object</p>
         * @param <T> The type contained by the iterator and target
         * @param me The target to add to (typically the caller)
         * @param itr The object to get items from
         * @return The number of items successfully proccessed
        public static final <T> int addAll(final Addable<T> me,
                final Iterable<T> itr) {
            int totalAdded = 0;
            if (itr instanceof List) {
                for (T element : (List<T>)itr)
                    if (me.add(element))
                        totalAdded++;
            } else {
                for (T element : itr)
                    if (me.add(element))
                        totalAdded++;
            return totalAdded;
}I would make Addable an abstract class with that default implementation for addAll, but alas, Java only allows single class inheritance, and I can't even make that DefaultBehavior class protected (which would make more sense than public).
* @param <T> {@inheritDoc}
public interface GroupingAddable<T> extends Addable<T> {
     * Indicates the items added since the last call to this method should be
     * associated under the given combination of keys</p>
     * @param keys The keys that identify this group
     * @return The number of items that were added to the group
    public int group(Object... keys);
     * Supplies some default implementations of the methods in this interface
     * </p><p>
     * This member would be more suited to {@code static protected} access, but
     * the JLS does not allow protected members of interfaces.<p>
    public static class DefaultBehavior {
         * Ensures that this {@code Addable} takes appropriate action on all the
         * items returned by the iterator of the specified iterable object</p>
         * @param <F> The type contained by the iterator and target
         * @param me The target to add to (typically the caller)
         * @param itr The object to get items from
         * @return The number of items successfully proccessed
        public static final <F extends File> int addAll(
                final DuplicatesStore<F> me,
                final Iterable<F> itr) {
            int totalAdded = 0;
            if (itr instanceof List) {
                for (F element : (List<F>)itr)
                    if (me.add(element))
                        totalAdded++;
            } else {
                for (F element : itr)
                    if (me.add(element))
                        totalAdded++;
            return totalAdded;
         * Wraps a given {@code DuplicatesStore} in a
         * {@link GroupingAddable} that passes calls to the given store</p>
         * @param <F> The type accepted by the given store
         * @param store The object to wrap
         * @return An {@code Addable} wrapper for the given store
        public static final <F extends File> GroupingAddable<F>
                asGroupingAddable(final DuplicatesStore<F> store) {
            return new GroupingAddable<F>() {
                public int group(Object... keys) {
                    return store.group(keys);
                public boolean add(F addMe) {
                    return store.add(addMe);
                public int addAll(Iterable<F> itr) {
                    return store.addAll(itr);
        protected DefaultBehavior() {
            throw new UnsupportedOperationException("Class has no instance members");
}Note that the following class exposes the same public API as GroupingAddable, but the aforementioned name clash requires this copy
public interface DuplicatesStore<F extends File> {
     * Adds a duplicate to the current group of duplicates</p>
     * @param addMe The duplicate to add to the current group of duplicates
     * @return true if the add operation succeeded, false otherwise
    public boolean add(F addMe);
     * Ensures that this {@code Addable} takes appropriate action on all the
     * items returned by the iterator of the specified iterable object</p>
     * @param itr The object to get items from
     * @return The number of items successfully proccessed
    public int addAll(Iterable<F> itr);
     * Marks the previous file {@code add}ed as the last of a group of files
     * that are duplicates.</p>
     * @param keys Ignored
     * @return The number of files in the group that was just marked
    public int group(Object... keys);
     * Supplies some default implementations of the methods in this interface
     * </p><p>
     * This member would be more suited to {@code static protected} access, but
     * the JLS does not allow protected members of interfaces.<p>
    public static class DefaultBehavior {
         * Ensures that this {@code Addable} takes appropriate action on all the
         * items returned by the iterator of the specified iterable object</p>
         * @param <F> The type contained by the iterator and target
         * @param me The target to add to (typically the caller)
         * @param itr The object to get items from
         * @return The number of items successfully proccessed
        public static final <F extends File> int addAll(
                final DuplicatesStore<F> me,
                final Iterable<F> itr) {
            int totalAdded = 0;
            if (itr instanceof List) {
                for (F element : (List<F>)itr)
                    if (me.add(element))
                        totalAdded++;
            } else {
                for (F element : itr)
                    if (me.add(element))
                        totalAdded++;
            return totalAdded;
         * Wraps a given {@code DuplicatesStore} in a
         * {@link GroupingAddable} that passes calls to the given store</p>
         * @param <F> The type accepted by the given store
         * @param store The object to wrap
         * @return An {@code Addable} wrapper for the given store
        public static final <F extends File> GroupingAddable<F>
                asGroupingAddable(final DuplicatesStore<F> store) {
            return new GroupingAddable<F>() {
                public int group(Object... keys) {
                    return store.group(keys);
                public boolean add(F addMe) {
                    return store.add(addMe);
                public int addAll(Iterable<F> itr) {
                    return store.addAll(itr);
        protected DefaultBehavior() {
            throw new UnsupportedOperationException("Class has no instance members");
}And we're getting closer to an actual implementation. I have both a LinkedList and ArrayList implementation of this interface, but I'm only posting the ArrayList. This would also be a good candidate for an abstract class, but then I wouldn' be able to inherit from java.util classes. The methods specified by this interface have the same implenation in both the ArrayList and LinkedList versions.
* A list of {@link LinkedList} specically for storing and grouping
* duplicate files</p>
* @param <F> The type contained by this list
public interface DuplicatesList<F extends File> extends List<LinkedList<F>>,
        DuplicatesStore<F> {
     * Adds a duplicate to the current group of duplicates</p>
     * @param file The duplicate to add to the current group of duplicates
     * @return true if the add operation succeeded, false otherwise
    public boolean add(F file);
     * Marks the previous file {@code add}ed as the last of a group of files
     * that are duplicates.</p>
     * @param keys Ignored
     * @return The number of files in the group that was just marked
    public int group(Object... keys);
     * Retreives the number of files added to this collection.</p>
     * <p>
     * This is not the number of collections contained immediately within
     * this collection, but the count of all files contained in this
     * collection's collections</p>
     * @return The count of files contained
    public int records();
     * {@inheritDoc}
     * @param <F> The type contained by the object that contains an instance of
     *      this class
    public class DefaultBehavior<F extends File> extends
            DuplicatesStore.DefaultBehavior {
         * Temporary storage for duplicate files until {@code group} is called,
         * at which point this variable is added to {@code this}, then cleared
        protected LinkedList<F> innerStore = new LinkedList<F>();
        /** The number of files added to {@code this} */
        protected int records = 0;
        protected DefaultBehavior() {
         * Adds a duplicate to the current group of duplicates</p>
         * @param me Ignored
         * @param file The duplicate to add to the current group of duplicates
         * @return true if the add operation succeeded, false otherwise
        public final boolean add(DuplicatesList<F> me, final F file) {
            records++;
            return innerStore.add(file);
         * Marks the previous file {@code add}ed as the last of a group of files
         * that are duplicates.</p>
         * This particular implementation will remove the first element added to
         * the group, sort the group according to its natural order, add the
         * element that was removed to the beginning of the group, then add the
         * linked list representing the group to this {@code LinkedList}.</p>
         * @param me The object to operate on (typically "this")
         * @param keys Ignored
         * @return The number of files in the group that was just marked
        public final int group(final DuplicatesList<F> me,
                final Object... keys) {
            int innerSize = innerStore.size();
            if (innerSize > 1) {
                F base = innerStore.pop();
                sort(innerStore);
                innerStore.addLast(base);
            if (me.add(innerStore)) {
                innerStore = new LinkedList<F>();
                return innerSize;
            } else return -1;
}And the implentation
* An {@code ArrayList} implementation of {@link DuplicatesList}</p>
* <p>
* Groups are contained in {@code LinkedList}s stored within this
* {@code ArrayList}.</p>
* @param <F> {@inheritDoc}
public class DuplicatesArrayList<F extends File>
        extends ArrayList<LinkedList<F>> implements DuplicatesList<F> {
     * Constructs a list containing the elements of the specified
     * collection, in the order they are returned by the collection's
     * iterator</p>
     * <p>
     * (Documentation copied from {@link ArrayList})</p>
     * @param addMe The collection whose elements are to be placed into this
     *      list
     * @throws NullPointerException If the specified collection is null
    protected DuplicatesArrayList(Collection<? extends LinkedList<F>> addMe) {
        super(addMe);
        def.records = super.size();
     * {@inheritDoc}
     * @param itr {@inheritDoc}
     * @return {@inheritDoc}
    @SuppressWarnings("static-access")
    public int addAll(Iterable<F> itr) {
        return def.addAll(this, itr);
     * {@inheritDoc}
     * @param file {@inheritDoc}
     * @return {@inheritDoc}
    public boolean add(F file) {
        return def.add(this, file);
     * {@inheritDoc}
     * <p>
     * This particular implementation will remove the first element added to
     * the group, sort the group according to its natural order, add the
     * element that was removed to the beginning of the group, then add the
     * linked list representing the group to this {@code ArrayList}.</p>
     * @param keys {@inheritDoc}
     * @return {@inheritDoc}
    public int group(Object... keys) {
        return def.group(this, keys);
     * {@inheritDoc}
     * @return {@inheritDoc}
    public int records() {
        return def.records;
}Here's an alternative to the collection-type DuplicatesStore I just showed you
* An object that prints duplicates as they are grouped</p>
* <p>
* The first file added to the group is appended to the {@link Appendable}
* provided at construction.  If specified at construction time, the system-
* specific path separator (as specified by {@link File#pathSeparator} then
* the file's length are also appended.  Then the previous text is followed
* by the system line separator (as specified by
* {@code System.getProperty("line.separator")}).  Any files
* that were added after it are appended in the same way, but are preceded
* by a horizontal tab, are not followed by their length.</p>
public class PrintingDuplicatesStore
        implements DuplicatesStore<File>, GroupingAddable<File> {
     * The system-specific line separator
    public static final String LINE_SEPARATOR =
            System.getProperty("line.separator");
     * The exception that contains any uncaught {@code Throwable}s thrown
     * during a call to {@code group} or {@code add}
    public static class AppendException extends RuntimeException {
         * Creates a new AppendException with it's cause set to the given
         * {@code Throwable} and messages set to the parameter's messages
         * @param cause The {@code Throwable} that caused this
         *      {@code AppendException} to be thrown
        public AppendException(final Throwable cause) {
            super(cause);
         * {@inheritDoc}
         * @return {@inheritDoc}
        public String getMessage() {
            return getCause().getMessage();
         * {@inheritDoc}
         * @return {@inheritDoc}
        public String getLocalizedMessage() {
            return getCause().getMessage();
     * This object to send output to
    protected Appendable out;
     * Whether this object is appending unique files (files in a group that
     * was only added to once) to the output
    protected boolean printingUniques;
     * Whether this object is appending files that have copies (groups with
     * more than one file) to the output
    protected boolean printingCopies;
     * Whether this object appends a path separator and the file's length
     * to the output after the first file of a group is appended
    protected boolean printingLength;
    /**The first file addded to the current group (null if the group is new)
    protected File currentBase = null;
    /** The number of files in the current group*/
    protected int groupSize = 0;
     * Creates a new instance whose behavior is specified by the given
     * parameters</p>
     * @param out The output to append to
     * @param printUniques Specifies if this object should append unique
     *      files
     * @param printCopies Specifies if this object should append files that
     *      have copies
     * @param printLength Specifies if this object should append the lengths
     *      of the files in a goup
    public PrintingDuplicatesStore(final Appendable out,
            final boolean printUniques, final boolean printCopies,
            final boolean printLength) {
        this.out = out;
        this.printingUniques = printUniques;
        this.printingCopies = printCopies;
        this.printingLength = printLength;
     * Add a file to the current group</p>
     * @param addMe The file to add
     * @return {@code true} always
     * @throws AppendException if an IOException occurs whilst attempting to
     *      append to the output.  The AppendException's cause is set to
     *      the IOException that was thrown.
    public boolean add(final File addMe) {
        try {
            if (currentBase == null) {
                currentBase = addMe;
                groupSize++;
            } else
            if (printingCopies) {
                out.append(addMe.toString());
                groupSize++;
            return true;
        } catch (final IOException ioe) {
            throw new AppendException(ioe);
     * Appends the file paths added since the last call to this method to
     * the output designated at construction</p>
     * @param keys Ignored
     * @return The number of files added between the last call and this call
     *      to this method
     * @throws AppendException if an IOException occurs whilst attempting to
     *      append to the output.  The AppendException's cause is set to
     *      the IOException that was thrown.
    public int group(final Object... keys) {
        try {
            if (groupSize == 1 && printingUniques)
                appendBase(currentBase);
        } catch (IOException ioe) {
            throw new AppendException(ioe);
        int rv = groupSize;
        groupSize = 0;
        return rv;
     * Called to append the base file to the output (follow the file name
     * with a path separator, a space, and the file's length, if neccessary)
     * </p>
     * @param base The file to add that is the base file for the group
     * @throws IOException If an IOException occurs whilst attempting to
     *      append to the output
    protected void appendBase(final File base) throws IOException {
        out.append(base.toString());
        if (printingLength)
            out.append(File.pathSeparator).append(" ")
                    .append(Long.toString(base.length()));
        out.append(LINE_SEPARATOR);
     * {@inheritDoc}
     * @param itr {@inheritDoc}
     * @return {@inheritDoc}
    public int addAll(final Iterable<File> itr) {
        return GroupingAddable.DefaultBehavior.addAll(this, itr);
* An object that prints duplicates, in order, as they are grouped</p>
* <p>
* The only difference between this and its superclass is that this removes
* and prints the first element in the group, then sorts the remaining
* elements before printing them.</p>
public class SortPrintingDuplicatesStore extends PrintingDuplicatesStore {
    /** Temporary storage for the current group */
    LinkedList<File> duplicates = new LinkedList<File>();
     * Creates a new instance whose behavior is specified by the given
     * parameters
     * @param out The output to append to
     * @param printUniques Specifies if this object should append unique
     *      files
     * @param printCopies Specifies if this object should append files that
     *      have copies
     * @param printLength Specifies if this object should append the lengths
     *      of the files in a goup
    public SortPrintingDuplicatesStore(final Appendable out,
            final boolean printUniques, final boolean printCopies,
            final boolean printLength) {
        super(out, printUniques, printCopies, printLength);
     * {@inheritDoc}
     * @param addMe {@inheritDoc}
     * @return {@inheritDoc}
    public boolean add(File addMe) {
        return duplicates.add(addMe);
     * {@inheritDoc}
     * @param keys {@inheritDoc}
     * @return {@inheritDoc}
    public int group(Object... keys) {
        try {
            groupSize = duplicates.size();
            if (groupSize > 1)
                if (printingCopies) {
                    appendBase(duplicates.pop());
                    sort(duplicates);
                    while (duplicates.size() > 0)
                        out.append("\t")
                                .append(duplicates.pop().toString())
                                .append(LINE_SEPARATOR);
                    return groupSize;
                } else
                    duplicates = new LinkedList<File>();
            else
            if (printingUniques)
                    appendBase(duplicates.pop());
            return groupSize;
        } catch (IOException ioe) {
            throw new AppendException(ioe);
}And the method that spawned all those interfaces and classes above
* Find identical files.</p>
* <p>
* Functions like {@code getDuplicates(bases, order, exceptions, subjects)},
* except that files in {@code subjects} that are found to be duplicates of
* files in {@code bases} are added to the given {@code store} instead of
* returned.</p>
* <p>
* If {@code bases} is not null, then the first file added to {@code store}
* after each call to {@link DuplicatesStore#group} is from {@code bases}.
* </p>
* @param <F> The desired type the returned collection should contain.  It
*      must be {@link File} or a subtype, and all elements in both
*      {@code bases} and {@code subjects} must be assignable to it.
* @param bases The only files to look for duplicates of
* @param order A comparator to apply to files
* @param exceptions The collection to add exceptions to, if they occur
* @param store The collection to store duplicate files in
* @param subjects The files to search for duplicates in.  Must implement
*      hasNext, next, hasPrevious, previous, and remove
* @see #getDuplicates(Collection, Comparator, Collection, ListIterator)
public static final <F extends File> void getDuplicates(
        final Collection<? extends F> bases, final Comparator<File> order,
        final Collection<? super IOException> exceptions,
        final GroupingAddable<? super F> store,
        final ListIterator<? extends F> subjects) {...}

Similar Messages

  • Two symbols, have same code, yet one behaves erratic.  Both stage and symbol timelines used.

    Here is a link to the problem site using edge: http://pbpromos.com/test-edge/
    Basically, there is a random or erratic behaviour with the symbol/box on the right when you go into and out of it by pressing the button on the bottom which makes it scale out and in.  The symbol/box on the left always behaves like it should no matter how many times you press the bottom button scaling it out/in.  However, for the symbol/box on the right, it skips animation steps at random times by pressing the bottom buttons.  When you first load the page, the right symbol/box scales out/in properly and may take a few times to reproduce the problem.  Sometimes you have to try also going in and out of the symbol on the left and then try the symbol on the right to make it show this erratic behavior.
    MORE DETAIL:
    The symbol all the way to the right ( Merchant Dashboard ) is not behaving like the one on the left.  When you go into them with the bottom button, the symbol scales out towards you making it bigger and pushes the symbol on the left out.  When you press on the RETURN button on the bottom it should scale back by playing the animation in REVERSE.  It does this by playing the stage and symbol timelines in reverse all the way to the start of their respective timelines.  This works fine for the right symbol if you try going in and out several times, however, the right symbol behaves eratically when trying to go in and out multiple times.  Yet they both have identical code.
    If you try going in and out you will see what I mean.
    There are three timelines.  The stage timeline and the two symbol timelines.  To scale out when you press the bottom red button, I play the stage timeline and the symbol's timeline.  Here is the code at the stage level triggered by the buttons which are found inside the two symbols:
    Right button (CLICK): "DASHBOARD LOGIN"
    sym.play("Dashboard");   // Label at the symbol timeline
    sym.getComposition().getStage().play("Dashboard");   // Label on the stage timeline
    Left button (CLICK): "REDEEM VOUCHER"
    sym.play("RedeemVoucher");   // Label at the symbol timeline
    sym.getComposition().getStage().play("RedeemVoucher");   // Label on the stage timeline
    When the stop(); is reached and the symbols scale out, I display the "RETURN TO MERCHANT AREA" button.  When this is clicked this code is executed within the symbols:
    sym.playReverse();
    sym.getComposition().getStage().playReverse();
    Any thoughts would be appreciated.
    Here is the link to oam file: https://www.dropbox.com/s/r33fu86779012yn/Adobe-Edge-Test-1.oam

    ok, I stand before you, head bowed in humiliation, begging for your forgiveness :-)
    I'm not sure what is going on but I found the font problem (or at least it seems so).
    Somehow (and I don't know how but I think I've been "duplicating the same folder content each time I start a new page to test and make changes (since the problem, I have been scared to touch anything that WAS working).
    Well, it seems that the "duplicated" folder was missing my "CSS" folder in every one!
    That explains why, even though the fonts and all the settings in Edge showed everything as being correct - they were; all except the CSS page that loaded the fonts!!!
    Again, I humbly apologize - I really do try and find the problem BEFORE posting here; this one just eluded me :-)
    James

  • Getting the JAXB exception like "Two classes have the same XML type name-"

    Getting the JAXB exception like "Two classes have the same XML type name...",
    Here is the exception details:
    Exception in thread "main" com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions Two classes have the same XML type name "city". Use @XmlType.name and @XmlType.namespace to assign different names to them. this problem is related to the following location: at com.model.City at public com.model.City com.model.Address.getCurrentCity() at com.model.Address this problem is related to the following location: at com.common.City at public com.common.City com.model.Address.getPreviousCity() at com.model.Address
    at com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException$Builder.check(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(Unknown Source) at com.sun.xml.internal.bind.v2.ContextFactory.createContext(Unknown Source) at com.sun.xml.internal.bind.v2.ContextFactory.createContext(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at javax.xml.bind.ContextFinder.newInstance(Unknown Source) at javax.xml.bind.ContextFinder.find(Unknown Source) at javax.xml.bind.JAXBContext.newInstance(Unknown Source) at javax.xml.bind.JAXBContext.newInstance(Unknown Source) at com.PojoToXSD.main(PojoToXSD.java:17)
    I took the example like:
    package com.model; ---->this package contains 'Address' class and 'City' class
    public class Address {
    private String areaName; private City currentCity; private com.common.City previousCity;
    package com.model;
    public class City {
    private String cityName;
    Another city class in "com.common" package.
    package com.common;
    public class City {
    private String pinCode;
    We need to create XSDs and needs to do the Marshalling and unmarshalling with the existing code in our project(like as above example code), code does not have any annotations like "@XmlRootElement/@XmlType" and we can not able to change the source code.
    I would like to know is there any solution to fix the above issue or any other ways to create XSDs and marshaling/unmarshalling(like MOXy..etc)?
    It would be great if i can get the solution from any one....May thanks in advance.
    Thanks,
    Satya.

    Getting the JAXB exception like "Two classes have the same XML type name...",
    Here is the exception details:
    Exception in thread "main" com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions Two classes have the same XML type name "city". Use @XmlType.name and @XmlType.namespace to assign different names to them. this problem is related to the following location: at com.model.City at public com.model.City com.model.Address.getCurrentCity() at com.model.Address this problem is related to the following location: at com.common.City at public com.common.City com.model.Address.getPreviousCity() at com.model.Address
    at com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException$Builder.check(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(Unknown Source) at com.sun.xml.internal.bind.v2.ContextFactory.createContext(Unknown Source) at com.sun.xml.internal.bind.v2.ContextFactory.createContext(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at javax.xml.bind.ContextFinder.newInstance(Unknown Source) at javax.xml.bind.ContextFinder.find(Unknown Source) at javax.xml.bind.JAXBContext.newInstance(Unknown Source) at javax.xml.bind.JAXBContext.newInstance(Unknown Source) at com.PojoToXSD.main(PojoToXSD.java:17)
    I took the example like:
    package com.model; ---->this package contains 'Address' class and 'City' class
    public class Address {
    private String areaName; private City currentCity; private com.common.City previousCity;
    package com.model;
    public class City {
    private String cityName;
    Another city class in "com.common" package.
    package com.common;
    public class City {
    private String pinCode;
    We need to create XSDs and needs to do the Marshalling and unmarshalling with the existing code in our project(like as above example code), code does not have any annotations like "@XmlRootElement/@XmlType" and we can not able to change the source code.
    I would like to know is there any solution to fix the above issue or any other ways to create XSDs and marshaling/unmarshalling(like MOXy..etc)?
    It would be great if i can get the solution from any one....May thanks in advance.
    Thanks,
    Satya.

  • Two classes have the same XML type name??? Please, help...

    Hello!
    I have a simple web service class. I generated the ws server-side classes using wsgen.
    I created a jar file from the generated code.
    Then :
    Endpoint endPoint = Endpoint.create(
    new WebServicesUnitImpl()
    String wsFinalName = "http://localhost:9999/akarmi";
    endPoint.publish( wsFinalName );
    The web service started fine.
    Then called wsimport, and the generated classes have been placed into a jar file.
    Then called the code like this:
    WebServicesUnitImplService service = new WebServicesUnitImplService();
    WebServicesUnitImpl unit = service.getWebServicesUnitImplPort();
    unit.serviceXXX();
    but the code doesn't work at all, resulting this error message:
    Two classes have the same XML type name "{http://ws.components.core.ilogique.vii.com/}getMessages". Use @XmlType.name and @XmlType.namespace to assign different names to them.
         this problem is related to the following location:
              at com.vii.ilogique.core.components.ws.GetMessages
              at public com.vii.ilogique.core.components.ws.GetMessages com.vii.ilogique.core.components.ws.ObjectFactory.createGetMessages()
              at com.vii.ilogique.core.components.ws.ObjectFactory
         this problem is related to the following location:
              at com.vii.ilogique.core.components.ws.GetMessages
    I have this error report on all generated class file! How can i fix this?
    What is the main problem? The SE usage? I copied the lates jax-ws jars into endorsed lib resulting the same.
    Any help is appreciate.

    Hello!
    I have a simple web service class. I generated the ws server-side classes using wsgen.
    I created a jar file from the generated code.
    Then :
    Endpoint endPoint = Endpoint.create(
    new WebServicesUnitImpl()
    String wsFinalName = "http://localhost:9999/akarmi";
    endPoint.publish( wsFinalName );
    The web service started fine.
    Then called wsimport, and the generated classes have been placed into a jar file.
    Then called the code like this:
    WebServicesUnitImplService service = new WebServicesUnitImplService();
    WebServicesUnitImpl unit = service.getWebServicesUnitImplPort();
    unit.serviceXXX();
    but the code doesn't work at all, resulting this error message:
    Two classes have the same XML type name "{http://ws.components.core.ilogique.vii.com/}getMessages". Use @XmlType.name and @XmlType.namespace to assign different names to them.
         this problem is related to the following location:
              at com.vii.ilogique.core.components.ws.GetMessages
              at public com.vii.ilogique.core.components.ws.GetMessages com.vii.ilogique.core.components.ws.ObjectFactory.createGetMessages()
              at com.vii.ilogique.core.components.ws.ObjectFactory
         this problem is related to the following location:
              at com.vii.ilogique.core.components.ws.GetMessages
    I have this error report on all generated class file! How can i fix this?
    What is the main problem? The SE usage? I copied the lates jax-ws jars into endorsed lib resulting the same.
    Any help is appreciate.

  • How could JNDI differentiate two ejb have same jndi name but on difference

    how could JNDI differentiate two ejb have same jndi name but on difference server
    suppose that:
    we have two J2EE Server those are Server1 and server2, and both of them have a ejb named Test deployed on it, and I need a java client maybe it is a java Application, servlet or ejb in server1 to get the reference to the ejb name Test, how to use JNDI to get the reference to both of them. those two ejb have same name but on difference server. how could the java client locate them?

    You've hit problem #1 in the alleged scalability of EJB containers.
    Basically, the whole setup assumes that you're only dealing with one naming service. The expectation is that a given name is bound to a single object, which in this case is the Home interface.
    Some systems support clustering, which can allow you to get round this, but the details will depend on you EJB container vendor,
    Sylvia.

  • On new MacPro with Microsoft Office, two email accounts (same server) yet one is fine the other dumps 35,000 emails into inbox. Apple consultants no help. How do I get the 35000 email account fixed?

    On new MacPro with Microsoft Office. Two email accounts, same service provider and server, yet one email account is fine and the other dumped the entire server of 35,000 emails into inbox. Need to keep server load for business, but how can emulating server on one account be fixed?

    You should clean up your inbox on the server. Log into the account's web interface and move the 35,000 emails out of the inbox into another folder. Why do you need to keep 35,000 emails in the inbox? An email client like OutLook etc. using POP protocol downloads all the inbox emails to your computer.

  • Passing variables and methods between two class files

    I created two simple programs to see what I can learn about how separate class files work together.
    There are two files, Alpha.java and Beta.java. Both are located in the same folder.
    Here�s Alpha.java:
    ********* Alpha.java *********
    public class Alpha {
    public int alphaInt;
    public void alphaMethod() {
    System.out.println("This is Alpha's alphaMethod.");
    ******** End Alpha **********
    Here�s Beta.java
    ******** Beta.java ***********
    public class Beta {
    public static void main() {
    Alpha a = new Alpha();
    a.alphaInt = 10;
    System.out.println(The value of alphaInt is " + a.alphaInt);
    a.alphaMethod();
    ******** End Beta ***********
    Alpha compiles fine. Beta does not compile and I get this error:
    �Exception in thread �main� java.lang.NoSuchMethodError: main�
    My first problem to solve is to get Beta to compile. After that I should be able to run it from the command line and get something like this as output:
    �The value of alphaInt is 10�
    �This is Alpha�s alphaMethod.�
    Would some kind people please help me with this?
    TIA,
    Logan

    That was easy, and it confirms what I thought should happen. Now for the real question:
    Alpha and Beta are servlets in a package called abClasses. Alpha starts out like this:
    package abClasses;
    import javax.servlet.*;
    import javax.servlet.jsp.*;
    import java.util.*;
    import javax.servlet.http.*;
    import java.sql.*;
    public class Alpha extends HttpServlet {
    Beta is the same, except for the name of course.
    Alpha creates a Connection variable, and Beta is going to use it. But when I try to compile Alpha I get an error that says this:
    cannot resolve symbol
    symbol: class Alpha
    location: abClasses.Beta
    Alpha a = new Alpha();
    Any suggestions on why what we did in the simple Alpha and Beta programs won't work in the Alpha and Beta servlets?
    You are appreciated,
    Logan

  • Show Rows Where Two Columns have Same Data

    Hello,
    I have a spreadsheet that I need to sort by showing me all the rows where the data is equal between two columns.
    I.E. I have a column called Last Name and I have another column, U, with some of those Last Names, I want to sort the spreadsheet to show me only the rows that match up with the same Last Name in coumn a and U.
    Thanks for any help.
    L

    To sort the table:
    Add two columns to the table. For this discussion, I'll refer to them as columns AA and AB.
    In AA2, enter: =ROW()
    Fill to the bottom of the table. With all f these cells selected, Copy, then Edit > Paste Values.
    This gives you a column you can sort by to restore the original order of the table.
    In AB2, enter: =IF(A=U,U," ") using option-space between the double quotes.
    Visually, this will repeat the duplicated names once more in column AB.
    An ascending sort on column AB will bring all rows with duplicate data in columns A and U to the top of the table.
    For greater visibility You might also add a conditional format rule to all of column AB, as I've done here for column D:
    The box to the right of "Text doesn't contain" contains a single 'option-space' character. The ascending sort (on column D) has not yet been done.
    Regards,
    Barry

  • Did Time Machine restore, now two apps have white slash in circle over icon in dock

    Yesterday morning my disk drive failed in my macbook pro, so I bought a new drive, installed it, installed 10.6 on it, then at the end of the install used my Time Machine backup (luckily it was from Sat night) to restore me on the drive.  Ran a couple of rounds of Software Update, and I seem to be pretty much back to where I was.  (Except that gmail had deleted my mail from the server!)
    Now my Numbers (iWork '09) and Xcode icons in my dock have a white slash-line-in-circle over them, and they are greyed out.  Both apps still seem to work just fine, and when launched they get the white light next to them.  When Xcode launches, the icon goes back to its bright color and the white slash/circle disappears, only to return when the app is Quit.  With Numbers the icon stays in its weird state while the program runs merrily along.
    Can anyone out there un-puzzle me?
    (While people often write whining and/or ranting complaints about this and that piece of apple technology, which sometimes get deleted by the moderators as violating the TOS, would it be ok if I write a slobbery mash note about how I LOVE LOVE LOVE LOVE LOVE Time Machine?  THANK YOU APPLE!  When a windoze user loses a disk, they are SCREWED.  Every PENNY that I have spent over the years paying a little more for Apple technology paid back a hundredfold yesterday!)

    I installed from a 10.6.0 disk, and selected Restore from Time Machine backup at the end of the install.  Then the first thing I did was install the 10.6.8 ComboUpdate, and after rebooting then did all of the other updates that came up in Software Update.
    (Oddly enough, I had the ComboUpdate dmg in my downloads directory, and when I tried to install it, the Installer failed immediately.  The one that SoftwareUpdate downloaded from Apple took a long time to download, but it worked just fine.  I used that dmg to update a couple of dozen machines back when 10.6.8 was new and had no problems.)

  • Extending map (name clash)

    hi,
    what's wrong with the following code, it does not compile saying:
    name clash: get(K) in org.raft.karpuz.common.UniqueMap<K,V> and get(java.lang.Object) in java.util.TreeMap<K,V> have the same erasure, yet neither overrides the other
    public class UniqueMap<K, V> extends TreeMap<K, V> {
        /** Creates a new instance of UniqueMap */
        public UniqueMap() {
        /** @throws DuplicateKeyException if key already exist. */
        public V put(K key, V value) {
            if (containsKey(key))
                throw new DuplicateKeyException("'" + key + "' for " + value.getClass());
            return super.put(key, value);
        /** @throws NoSuchElementException if key not found */
        public V get(K key) {
            if (! containsKey(key))
                throw new NoSuchElementException("'" + key + "' not found");
            return super.get(key);
    r a f t

    here is the answer, i found it but couldnt give a meaning:
    the method signature of Map<K, V>.get(key) is
    V get(Object key) but not
    V get(K key)similarly remove, containsKey methods take key parameter as Object instead of K. what is the reason ? by mistake or does it serve any purpose ?
    r a f t

  • Compiling simultaneously two classes referencing each other

    Hi,
    When we want to compile 2 classes simultaneously in a package, we give command --
    javac package-name/*.java
    Suppose the two classes are ClassA and ClassB and ClassA has a reference of ClassB. So the compiler will finish compiling ClassB before compiling ClassA.
    But, if both the classes have each others' reference, how does compiler resolve this? Because, even in that case both classes get compiled
    Regards,
    Amit

    Lets say that compilation is done in 2 steps.
    The first step is done for all files first.
    Then the second step is done for all files.
    That means that for the second step the compile-time resolution has takes place.
    Two classes that refers to each other must go through the first step in
    the same compilation so that in the second step when
    they are referring to each other they are easily resolved.
    This is different from runtime resolution.

  • Is it possible to extend two classes?

    I want to do something like :
    public class C extends A, B {
    public class E extends A, D {
    }The two classes have things in A in common, but have to extend other different classes (B, D) as there are other differences.

    Make A an interface. I mean it. Make A an interface.Thanks for the suggestion but I have identical code to duplicate and wanted an abstract class
    class A{
       private String commonValue;
       public String getCommonValue() { return commonValue; }
       public void processSomething() {
           // Will be identical code for every class needing A
    }I guess I need to make another abstract class and have that extend and than the parent class extend this..
    Just seems annoying to duplicate the same code 5 times
    Message was edited by:
    smiles78

  • Class implementing two interfaces with same methods

    interface Foo {
    public void execute();
    interface Bar {
    public void execute();
    class Dam implements Foo, Bar {
    public void execute() {
    //Which interface's execute method is being called here?
    How do I make the Damn class have different implemenations for the execute method of the Foo and the Bar interfaces?

    hi,
    //Which interface's execute method is being calledinterfaces' method are neither called to be executed by the JVM because they're not concrete implementation but only signature declaration.
    How do I make the Damn class have different
    implemenations for the execute method of the Foo and
    the Bar interfaces?this can't be done if the signatures are the same, but if they're not, for instance
    public void execute( int i )
    public void execute( String s )
    then you can have two implementation...anyway, what's the point if the signature are the same ? if you really want them to do different things why wouldn't you name them differently ?
    raphaele

  • Name clash when attempting to override a method in a paramaterized class

    The following code gives me a name clash, I do not understand why this happens, anyone care to explain?
    import java.util.Comparator;
    import java.util.Map;
    import java.util.Map.Entry;
    public class Test<K,V> {
         public void sort(Comparator<Entry<? extends K, ? extends V>> comparator) {
    class Test2<K, V> extends Test<K, V> {
         @Override
         public void sort(Comparator<Entry<? extends K, ? extends V>> comparator) {
              super.sort(comparator);
    }

    i think it it a version problem, thanks
    the error i get is:
    Name clash: The method sort(Comparator<Map.Entry<? extends K,? extends V>>) of
    type Test2<K,V> has the same erasure as sort(Comparator<Map.Entry<? extends
    K,? extends V>>) of type Test<K,V> but does not override it
    Message was edited by:
    hans_bladerDeeg

  • Clashes with class of same name: weblogic 6.0 sp2

              Hi Mike,
              Thanks for the response.
              I am getting this error
              C:\bea\testDir\jsp_servlet\_vgn\_portal\_system\_site\_edit.java:7: package jsp_servlet._vgn._portal._system
              clashes with class of same name
              Full compiler error(s): C:\bea\testDir\jsp_servlet\_vgn\_portal\_system\_site\_edit.java:7:
              package jsp_servlet._vgn._portal._system clashes with class of same name package
              jsp_servlet._vgn._portal._system._site; ^ 1 error
              This is the error on the screen and the messages I posted are from the weblogic.log
              Let me know if you need more info. Also, i found some suggestion somewhere that
              I should install rolling patch 2, bu i searched the downloads and did not find
              anything called Rolling Patch 2.
              Varun
              (No more information available, probably caused by another error) Michael Young
              <[email protected]> wrote:
              >Hi.
              >
              >Can you post the complete error? I don't see anything about class name
              >clashes in the exception you posted below.
              >
              >Cheers,
              >Michael
              >
              >Varun Garg wrote:
              >
              >> I am getting a "clashes with class of same name" error with some of
              >my jsp pages
              >> on weblogic 6.0 sp2. I have tried deleting my temporary jsp file, i
              >have tried
              >> using a working directory for the jsp using weblogic.xml.
              >>
              >> This happens for few files and not all of them
              >>
              >> java.io.IOException: Compiler failed executable.exec(java.lang.String[javac,
              >-classpath,
              >> C:\bea\wlserver6.0\config\mydomain\applications\DefaultWebApp_myserver;C:\bea\wlserver6.0\.\config\mydomain\applications\DefaultWebApp_myserver\WEB-INF\lib\ASTab.jar;C:\bea\testDir;C:\bea\jdk130\jre\lib\rt.jar;C:\bea\jdk130\jre\lib\i18n.jar;C:\bea\jdk130\jre\lib\sunrsasign.jar;C:\bea\jdk130\jre\classes;.;C:\bea\wlserver6.0\lib\weblogic_sp.jar;C:\bea\wlserver6.0\lib\weblogic.jar;C:\bea\wlserver6.0\lib\jce1_2_1.jar;C:\bea\wlserver6.0\lib\sunjce_provider.jar;C:\bea\wlserver6.0\lib\US_export_poli
              c
              >y.jar;C:\bea\wlserver6.0\lib\local_policy.jar;C:\bea\wlserver6.0\config\mydomain\applications\DefaultWebApp\WEB-INF\lib;;null,
              >> -d, C:\bea\testDir, C:\bea\testDir\jsp_servlet\_vgn\_portal\_system\_title.java])
              >> at weblogic.utils.compiler.CompilerInvoker.compileMaybeExit(CompilerInvoker.java:585)
              >> at weblogic.utils.compiler.CompilerInvoker.compile(CompilerInvoker.java:354)
              >>
              >> Thanks in advance for the help.
              >>
              >>
              >
              >--
              >Michael Young
              >Developer Relations Engineer
              >BEA Support
              >
              >
              

              Hi Mike,
              Thanks for the response.
              I am getting this error
              C:\bea\testDir\jsp_servlet\_vgn\_portal\_system\_site\_edit.java:7: package jsp_servlet._vgn._portal._system
              clashes with class of same name
              Full compiler error(s): C:\bea\testDir\jsp_servlet\_vgn\_portal\_system\_site\_edit.java:7:
              package jsp_servlet._vgn._portal._system clashes with class of same name package
              jsp_servlet._vgn._portal._system._site; ^ 1 error
              This is the error on the screen and the messages I posted are from the weblogic.log
              Let me know if you need more info. Also, i found some suggestion somewhere that
              I should install rolling patch 2, bu i searched the downloads and did not find
              anything called Rolling Patch 2.
              Varun
              (No more information available, probably caused by another error) Michael Young
              <[email protected]> wrote:
              >Hi.
              >
              >Can you post the complete error? I don't see anything about class name
              >clashes in the exception you posted below.
              >
              >Cheers,
              >Michael
              >
              >Varun Garg wrote:
              >
              >> I am getting a "clashes with class of same name" error with some of
              >my jsp pages
              >> on weblogic 6.0 sp2. I have tried deleting my temporary jsp file, i
              >have tried
              >> using a working directory for the jsp using weblogic.xml.
              >>
              >> This happens for few files and not all of them
              >>
              >> java.io.IOException: Compiler failed executable.exec(java.lang.String[javac,
              >-classpath,
              >> C:\bea\wlserver6.0\config\mydomain\applications\DefaultWebApp_myserver;C:\bea\wlserver6.0\.\config\mydomain\applications\DefaultWebApp_myserver\WEB-INF\lib\ASTab.jar;C:\bea\testDir;C:\bea\jdk130\jre\lib\rt.jar;C:\bea\jdk130\jre\lib\i18n.jar;C:\bea\jdk130\jre\lib\sunrsasign.jar;C:\bea\jdk130\jre\classes;.;C:\bea\wlserver6.0\lib\weblogic_sp.jar;C:\bea\wlserver6.0\lib\weblogic.jar;C:\bea\wlserver6.0\lib\jce1_2_1.jar;C:\bea\wlserver6.0\lib\sunjce_provider.jar;C:\bea\wlserver6.0\lib\US_export_poli
              c
              >y.jar;C:\bea\wlserver6.0\lib\local_policy.jar;C:\bea\wlserver6.0\config\mydomain\applications\DefaultWebApp\WEB-INF\lib;;null,
              >> -d, C:\bea\testDir, C:\bea\testDir\jsp_servlet\_vgn\_portal\_system\_title.java])
              >> at weblogic.utils.compiler.CompilerInvoker.compileMaybeExit(CompilerInvoker.java:585)
              >> at weblogic.utils.compiler.CompilerInvoker.compile(CompilerInvoker.java:354)
              >>
              >> Thanks in advance for the help.
              >>
              >>
              >
              >--
              >Michael Young
              >Developer Relations Engineer
              >BEA Support
              >
              >
              

Maybe you are looking for