classcastexception

Why am I getting a ClassCastException when generating javadocs?

半腔热情 提交于 2019-12-17 17:53:45
问题 I'm using ant to generate javadocs, but get this exception over and over - why? I'm using JDK version 1.6.0_06 . [javadoc] java.lang.ClassCastException: com.sun.tools.javadoc.ClassDocImpl cannot be cast to com.sun.javadoc.AnnotationTypeDoc [javadoc] at com.sun.tools.javadoc.AnnotationDescImpl.annotationType(AnnotationDescImpl.java:46) [javadoc] at com.sun.tools.doclets.formats.html.HtmlDocletWriter.getAnnotations(HtmlDocletWriter.java:1739) [javadoc] at com.sun.tools.doclets.formats.html

can't cast to implemented interface

丶灬走出姿态 提交于 2019-12-17 06:14:55
问题 i'm very confused... I have a class which directly implements an interface: public class Device implements AutocompleteResult {...} Here is proof that I'm looking at the right variables: Object match = ...; log.debug(match.getClass()); // Outputs 'Device' log.debug(match.getClass().getInterfaces()[0]); // Outputs 'AutocompleteResult' Yet when I try to cast an instance of the class to the interface: AutocompleteResult result = (AutocompleteResult) match; I get a ClassCastException!

Singly linked list node not able to be cast as Integer

我的未来我决定 提交于 2019-12-14 03:24:47
问题 I am writing a generic singly linked list as a homework assignment. I have been given the JUnit test that the instructor is going to use to test the code. When I run the test, gives me this error: java.lang.ClassCastException: SinglyLinkedList$Node cannot be cast to java.lang.Integer. If I am using a generic as the type, why can't I cast it as an Integer? Also, when I first ran the test, the bash showed: JUnit version 4.12 .E.E.E. And it stayed like this until I ended the process. I think

Why TreeSet can be used as a key for TreeMap in jdk 1.6?

此生再无相见时 提交于 2019-12-13 18:42:58
问题 why does this: import java.util.*; public class my { public static void main(String[] a) { TreeMap<TreeSet<Integer>, String> map = new TreeMap<TreeSet<Integer>, String>(); TreeSet<Integer> set = new TreeSet<Integer>(); map.put(set, "lol"); } } work in Java 6? I mean that by specification putting TreeSet as a key of TreeMap without proper Comparator should lead to ClassCastException but it doesn't when running under Java 6. Was it a bug or there were some specification changes in Java 7 that

Gson ClassCastException (LinkedTreeMap)

天大地大妈咪最大 提交于 2019-12-13 08:44:00
问题 Using Gson to deserialize objects of a parameterized class Container<T> , results in the java.lang.ClassCastException for certain values of T , e.g. for a simple Record type consisting of String and List<String> fields: com.google.gson.internal.LinkedTreeMap cannot be cast to Record Interestingly enough, the same code works when calling the fromJson() method inline, i.e. the following statement does return a valid value: Container<Record> value = new Gson().fromJson( json, new TypeToken

SugarORM in AndroidManifest

你离开我真会死。 提交于 2019-12-13 05:53:16
问题 I've one problem: I use SugarORM for my app and in AndroidManifest I need to set this: <meta-data android:name="DATABASE" android:value="moneyManager.db" /> <meta-data android:name="VERSION" android:value="1"/> <meta-data android:name="QUERY_LOG" android:value="true"/> <meta-data android:name="DOMAIN_PACKAGE_NAME" android:value="ua.marinovskiy.moneymanager" /> And this: android:name="com.orm.SugarApp" And now, when I'm using startActivityForResult from adapter: Intent intent = new Intent

java.lang.ClassCastException: java.lang.String cannot be cast to javax.mail.Multipart

爱⌒轻易说出口 提交于 2019-12-13 04:41:40
问题 This is my code below taken from a java tutorial - however my issue comes in when I try and recieve a normal message sent from a computer, as opposed to sent through GMail. If I recieve the email through GMail it runs fine and returns the mail, however trying to retrieve a mail from a conventional desktop mail client returns Error: java.lang.ClassCastException: java.lang.String cannot be cast to javax.mail.Multipart at gridnotifierproject_pcbuild.HandleMailInput.retrieveOneMail

ClassCast Exception Android Studio

会有一股神秘感。 提交于 2019-12-13 01:24:48
问题 I am getting a ClassCastException in android studio while running my project. Can anyone tell me what is causing this error. ClassCastException: com.intellij.psi.impl.source.PsiPlainTextFileImpl cannot be cast to com.intellij.psi.xml.XmlFile Thanks. 回答1: Sovled this atlast. This Question helped me. Android Studio ClassCastException When Attempting to Open A Layout XML File . I had a 11MB xml file in values. That was the problem. After deleting that, the problem was solved. And if you want to

ClassCastException on itself after redeploy of same application`

五迷三道 提交于 2019-12-12 23:50:48
问题 I am developing a JSF application with Netbeans and Glassfish. When I change something and Netbeans redeploys to Glassfish, then a ClassCastException is been thrown on the entity class itself. Caused by: java.lang.ClassCastException: com.twibu.entity.Tipper cannot be cast to com.twibu.entity.Tipper at com.twibu.service.TipperService.findByUseridPwd(TipperService.java:22) How is this caused and how can I solve it? For reference, here's the full stack trace: WARNING: EJB5184:A system exception

Weird runtime error (ClassCastException while declaring)

孤人 提交于 2019-12-12 23:04:04
问题 I have the following code within a program I'm making: 01 public class Clazz<T> 02 { 03 T[] t; 04 05 public Clazz<T> methodA(int... ints) 06 { 07 Clazz<Integer> ints2 = new Clazz<>(); 08 int remInd[] = new int[t.length - ints2.t.length]; 09 return this; 10 } 11 } but when I run method methodA , I get this error: Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [Ljava.lang.Integer; at Clazz.methodA(Clazz.java:8) Why would I get this