Incompatible type for method
this is for school so you don't have to answer if you choose not to.
i have to have method signature that reads
public void BFEncrypt(String source, String target, byte code)throws IOException, FileNotFoundException{
but when i call the method
bfp.BFEncrypt("C:/WINDOWS/Desktop/ASSIGN3/test.txt","result.txt",12);
i'm told i have to convert an int to byte. it is defaulting the 12 at the end of the call to an int. i got the class, which is to read a file, encode it using the simple code passed in, and then re-write to work fine when making the signature int code. I was told that it had to be byte though and i can't get it to work.
thanks in advance
Well, then overload the method..
public void BFEncrypt(String source, String target, int code)throws IOException, FileNotFoundException {
//whatever goes here
public void BFEncrypt(String source, String target, byte code)throws IOException, FileNotFoundException {
BFEncrypt(source, target, (int) code);
}You could even test for values >127 <-128 and throw an exception. And you can use the same technique for short or long. (I did not try to compile this so no guarantees.)
Similar Messages
-
Non-varargs call of varargs method with inexact argument type for last para
i have no idea what the error:
non-varargs call of varargs method with inexact argument type for last parameter
means.
return (Component)sceneClass.getConstructor(
new Class[]{int.class, int.class}).newInstance(
new Integer[]{new Integer((int)sceneDimension.getWidth()),
new Integer((int)sceneDimension.getHeight())});
this is the problem area but i'm not sure how to get around it..
any help would be appreciatedI am a Java learner and I got the same warning. My code runs like this:
import java.lang.reflect.*;
class Reflec
public static void main(String[] args)
if(args.length!=1)
return;
try
Class c=Class.forName(args[0]);
Constructor[] cons=c.getDeclaredConstructors();
Class[] params=cons[0].getParameterTypes();
Object[] paramValues=new Object[params.length];
for(int i=0; i<params.length; i++)
if(params.isPrimitive())
paramValues[i]=new Integer(i+3);
Object o=cons[0].newInstance(paramValues);
Method[] ms=c.getDeclaredMethods();
ms[0].invoke(o, null);
catch(Exception e)
e.printStackTrace();
class Point
static
System.out.println("Point class file loaded and an object Point generated£¡");
int x, y;
void output()
System.out.println("x="+x+"\ny="+y);
Point(int x, int y)
this.x=x;
this.y=y;
When I compiled the file I got the following:
Reflec.java:26: warning: non-varargs call of varargs method with inexact argument type for last parameter;
cast to java.lang.Object for a varargs call
cast to java.lang.Object[] for a non-varargs call and to suppress this warning
ms[0].invoke(o, null);
^
1 warning
Since the problem was with this line "ms[0].invoke(o, null);" and the specific point falls on the last argument as the warning mentioned that " ... method with inexact argument type for last parameter", I simply deleted the argument "null" and the line becomes "ms[0].invoke(o);" and it works, no warning anymore!
DJ Guo from Xanadu
Edited by: Forget_Me_Not on Jan 8, 2009 10:39 AM -
Exception '1250' is not defined for method 'CREATE' object type 'MESSAGE'
Dear experts,
I set up the document distribution (SWU3, backgroundjob SMTP, activated the workflows, flagged the linkages, etc). Now, I have still a error:
Exception '1250' is not defined for method 'CREATE' object type 'MESSAGE'
Does anyone know what the cause of exception 1250 could be?
Thanks in advance and kind regards,
Samuelhi,
SAP ITS is SAP Internet Transaction Server which provides connection between SAP ERP system and html client.
Check with bassis, i think TCP/IP or work station application not configured yet. i guess?
Benakaraja
??P -
Exception '1003' is not defined for method 'SENDTASKDESCRIPTION' object type 'SELFITEM'
Hi All,
Please help me in this. I am trying to send a mail when user rejected the item in his inbox. I am getting error like
Exception '1003' is not defined for method 'SENDTASKDESCRIPTION' object type 'SELFITEM'. I tried so many ways like no attachments,send express ,siganture,encryption all disabled but still the same error from user outbox who ever rejects it.
Regards,
Madhu.Hi Madhu,
This exception is raised means you have checked the Signature check-box and encrypt check box.
Now you have unchecked that the issue should be solved , but if it is still giving the same exception synchronize your run time buffer using the t-code SWU_OBUF .
Let me know if the issue is still there.
Regards
Bikas -
Incompatible types error on a for loop
Hi. I am in the middle of making a program and a decided to make a print statment to check to make sure everything was organized as it should be and I got an incompatible types error for the line where I start my for loop - for (index = 0 ...) etc. Since everything is an int, I'm not sure how they're not compatible with each other.. thoughts? here's my code so far, thanks
import java.io.*; // needed for stream readers
import java.lang.*;
public class testScores extends Object
public static void main(String args[] ) throws Exception
// declare variables for input
String records;
String room_nbr_input;
String test_score_input;
String student_id;
int room_nbr_nbr;
int test_score_nbr;
int index;
String[] record = new String[3];
int[] room_nbr = new int[30];
int[] test_score = new int[30];
int[] kount = new int[30];
// created file reader and buffered reader
FileReader frM;
BufferedReader brM;
// open file
frM = new FileReader("einstein_testscores_2009.txt");
brM = new BufferedReader(frM);
// print headings
startUp();
// get one record from file
records = brM.readLine();
while(records !=null)
//split the record into three fields = the array record[], then assign those values to variables
record = records.split(", ");
student_id = record[0];
room_nbr_input = record[1];
test_score_input = record[2];
//change the data into integers
room_nbr_nbr = Integer.parseInt(room_nbr_input);
test_score_nbr = Integer.parseInt(test_score_input);
//put the variables into arrays
room_nbr[room_nbr_nbr -1] = room_nbr_nbr;
test_score[room_nbr_nbr -1] = test_score[room_nbr_nbr -1] + test_score_nbr;
//get new record
records = brM.readLine();
for (index = 0; index = room_nbr.length; index++)
System.out.print(room_nbr[index] + "\t\t" + test_score[index]);
public static void startUp()
System.out.print("Einstein Elementary Test Scores\n\n");
System.out.print("Room Number\t\tTest Score Average\n\n");
} // end of class declarationthank you. here's the code.
import java.io.*; // needed for stream readers
import java.lang.*;
public class testScores extends Object
public static void main(String args[] ) throws Exception
// declare variables for input
String records;
String room_nbr_input;
String test_score_input;
String student_id;
int room_nbr_nbr;
int test_score_nbr;
int index;
String[] record = new String[3];
int[] room_nbr = new int[30];
int[] test_score = new int[30];
int[] kount = new int[30];
// created file reader and buffered reader
FileReader frM;
BufferedReader brM;
// open file
frM = new FileReader("einstein_testscores_2009.txt");
brM = new BufferedReader(frM);
// print headings
startUp();
// get one record from file
records = brM.readLine();
while(records !=null)
//split the record into three fields = the array record[], then assign those values to variables
record = records.split(", ");
student_id = record[0];
room_nbr_input = record[1];
test_score_input = record[2];
//change the data into integers
room_nbr_nbr = Integer.parseInt(room_nbr_input);
test_score_nbr = Integer.parseInt(test_score_input);
//put the variables into arrays
room_nbr[room_nbr_nbr -1] = room_nbr_nbr;
test_score[room_nbr_nbr -1] = test_score[room_nbr_nbr -1] + test_score_nbr;
//get new record
records = brM.readLine();
for (index = 0; index = room_nbr.length; index++)
System.out.print(room_nbr[index] + "\t\t" + test_score[index]);
public static void startUp()
System.out.print("Einstein Elementary Test Scores\n\n");
System.out.print("Room Number\t\tTest Score Average\n\n");
} // end of class declaration -
Hi,
My DTP load failed due to following error.
Call of the method START_ROUTINE of the class LCL_TRANSFORM failed; wrong type for parameter SOURCE_PACKAGE
I don't think anything wrong with the following code as data loads successfully every day. Can any one check? What could be the issue?
METHOD start_routine.
*=== Segments ===
FIELD-SYMBOLS:
<SOURCE_FIELDS> TYPE _ty_s_SC_1.
DATA:
MONITOR_REC TYPE rstmonitor.
*$*$ begin of routine - insert your code only below this line *-*
* Fail safe which replaces DTP selection, just in case
DELETE SOURCE_PACKAGE WHERE version EQ 'A'.
* Fill lookup table for the ISPG
SELECT p~comp_code m~mat_plant m~/bic/zi_cpispg
INTO TABLE tb_lookup
FROM /bi0/pplant AS p INNER JOIN /bi0/pmat_plant AS m ON
p~objvers EQ m~objvers AND
p~plant EQ m~plant
FOR ALL ENTRIES IN SOURCE_PACKAGE
WHERE p~objvers EQ 'A' AND
p~comp_code EQ SOURCE_PACKAGE-comp_code AND
m~mat_plant EQ SOURCE_PACKAGE-material.
SORT tb_lookup BY comp_code material.
*$*$ end of routine - insert your code only before this line *-*
ENDMETHOD.Hi,
Compare the data types of the fields in your table tb_lookup with the data types in your datasource. Most probably there is an inconsistency with that. One thing that I realize is that
I use the select statement in the format select ... from ... into... Maybe you need to change places of that, but I am not sure. You may put a break point and debug it with simulation.
Hope it gives an idea.
Yasemin... -
Stuck with incompatibe types for the same generic variables
having trouble with generics
i have the static class Node<T> in a double linked list
whenever i make a node point to another node
i have incompatible type errors
Node<T> current;
Node<T> head;
src\DoubleList.java:135: incompatible types
found : DoubleList.Node<T>
required: DoubleList.Node<T>
current = head;Can you post more code? Specifically the class declarations for DoubleList and Node and a method where you have this issue. Please use the code tags (button above edit field) when you post.
-
Trouble at the end of this code involving incompatible types within word = listEasy.get(wordArrayLocation); along with the other two in that method. Says it needs a java.lang.String.
import java.util.Random;
import java.util.Scanner;
import java.util.ArrayList;
import java.io.FileReader;
import java.io.IOException;
import java.io.FileNotFoundException;
import java.lang.String;
public class WordArray
public WordArray() throws FileNotFoundException
Creation of 3 word arrays based off of the desired level of game difficulty
ArrayList<String> listEasy = new ArrayList<String>();
ArrayList<String> listIntermediate = new ArrayList<String>();
ArrayList<String> listHard = new ArrayList<String>();
//open the physical files (words*.txt) for use in the corresponding ArrayList
FileReader readerEasy = new FileReader("wordsEasy.txt");
FileReader readerIntermediate = new FileReader("wordsIntermediate.txt");
FileReader readerHard = new FileReader("wordsHard.txt");
use a Scanner object called "in*" to access the respective file handle.
Scanner inEasy = new Scanner(readerEasy);
Scanner inIntermediate = new Scanner(readerIntermediate);
Scanner inHard = new Scanner(readerHard);
Use a loop to walk through the input file WordsEasy.txt reading one line at a time.
while (inEasy.hasNext())
String record = inEasy.next();
listEasy.add(record);
Use a loop to walk through the input file WordsIntermediate.txt reading one line at a time.
while (inIntermediate.hasNext())
String record = inIntermediate.next();
listIntermediate.add(record);
Use a loop to walk through the input file WordsHard.txt reading one line at a time.
while (inHard.hasNext())
String record = inHard.next();
listHard.add(record);
inEasy.close();
inIntermediate.close();
inHard.close();
set ListEasy's size
public int setListEasySize()
listEasySize = listEasy.size();
set ListIntermediate's size
public int setListIntermediateSize()
listIntermediateSize = listIntermediate.size();
set ListHard's size
public int setListHardSize()
listHardSize = listHard.size();
public int setGeneratorLength(int difficultyLevel)
if (difficultyLevel == 3)
generatorLength = listHardSize - 1;
else if(difficultyLevel == 2)
generatorLength = listIntermediateSize - 1;
else
generatorLength = listEasySize - 1;
Picks a random word
@return
public int randWord()
Random generator = new Random();
wordArrayLocation = generator.nextInt(generatorLength);
public String getWord(int difficultyLevel)
if (difficultyLevel == 3)
word = listHard.get(wordArrayLocation);
else if(difficultyLevel == 2)
word = listIntermediate.get(wordArrayLocation);
else
word = listEasy.get(wordArrayLocation);
return word;
private String word;
private int wordArrayLocation;
private int generatorLength;
private int listEasySize;
private int listIntermediateSize;
private int listHardSize;
private ArrayList<WordArray> listEasy;
private ArrayList<WordArray> listIntermediate;
private ArrayList<WordArray> listHard;
}Here is what I have changed things to...
import java.util.Random;
import java.util.Scanner;
import java.util.ArrayList;
import java.io.FileReader;
import java.io.IOException;
import java.io.FileNotFoundException;
import java.lang.String;
public class WordArray
public WordArray() throws FileNotFoundException
Creation of 3 word arrays based off of the desired level of game difficulty
//open the physical files (words*.txt) for use in the corresponding ArrayList
FileReader readerEasy = new FileReader("wordsEasy.txt");
FileReader readerIntermediate = new FileReader("wordsIntermediate.txt");
FileReader readerHard = new FileReader("wordsHard.txt");
use a Scanner object called "in*" to access the respective file handle.
Scanner inEasy = new Scanner(readerEasy);
Scanner inIntermediate = new Scanner(readerIntermediate);
Scanner inHard = new Scanner(readerHard);
Use loops to walk through the input file reading one line at a time.
while (inEasy.hasNext())
String record = inEasy.next();
listEasy.add(record);
while (inIntermediate.hasNext())
String record = inIntermediate.next();
listIntermediate.add(record);
while (inHard.hasNext())
String record = inHard.next();
listHard.add(record);
inEasy.close();
inIntermediate.close();
inHard.close();
set the size of of the arraylists to a variable.
public void setListEasySize()
listEasySize = listEasy.size();
public void setListIntermediateSize()
listIntermediateSize = listIntermediate.size();
public void setListHardSize()
listHardSize = listHard.size();
//Set the difficulty level from user input
public void setDifficultyLevel(int difficulty)
difficultyLevel = difficulty;
//Calculate the wanted randomm generator length depending on the difficulty level
public void setGeneratorLength()
if (difficultyLevel == 3)
generatorLength = listHardSize - 1;
else if(difficultyLevel == 2)
generatorLength = listIntermediateSize - 1;
else
generatorLength = listEasySize - 1;
// Calculates what random arraylist location to pull an object from
public void randWord()
Random generator = new Random();
wordArrayLocation = generator.nextInt(generatorLength);
Sets the selected arraylist object to another object
public void setWordObject()
if (difficultyLevel == 3)
wordObject = (listHard.get(wordArrayLocation));
else if(difficultyLevel == 2)
wordObject = listIntermediate.get(wordArrayLocation);
else
wordObject = listEasy.get(wordArrayLocation);
returns the word
@return
public String getWord()
word = wordObject.toString();
return word;
private ArrayList<String> listEasy = new ArrayList<String>();
private ArrayList<String> listIntermediate = new ArrayList<String>();
private ArrayList<String> listHard = new ArrayList<String>();
private String word;
private Object wordObject;
private int difficultyLevel;
private int wordArrayLocation;
private int generatorLength;
private int listEasySize;
private int listIntermediateSize;
private int listHardSize;
}Edited by: jojavawuz on Nov 19, 2008 8:34 AM -
Incompatible Types... NOT!
Why am I getting incompatible types in this method?
C:\jdk1.3\src\CalcBusinessDays.java:53: incompatible types
found : java.util.Date
required: Date
Date covDate = sdf.parse(dt, pos);^ <-- carat is at end of line
public Date dateConvert(String dt) {
SimpleDateFormat sdf = new SimpleDateFormat("mm/dd/yyyy");
ParsePosition pos = new ParsePosition(0);
Date covDate = sdf.parse(dt, pos);
return covDate;
} //dateConvert
Thanks in advance.Actually I'm in Hartford, CT, where NJ sends its rain! I used to live in Staten Island which is close to NJ as you know. Also worked in Parsippany for a while.
I think "Date" needs to be changed to "java.util.Date" in three places. See comments below where changes are marked. I could not compile or test because I don't have Domino / Notes.
By the way, in case you get similar problems with another class (Calendar?), I believe that the lotus.domino classes are AgentBase, AgentContext, Session and DateTime. The others should be standard Java classes. Good Luck.
import java.util.*;
import java.text.*;
import java.math.*;
import lotus.domino.*;
public class CalcBusinessDays extends AgentBase {
public void NotesMain() {
DateTime startTime = null, endTime = null;
String startTimeStr, endTimeStr, result;
try {
Session session = getSession();
AgentContext agentContext = session.getAgentContext();
startTimeStr = "04/12/2000";
endTimeStr = "05/04/2000";
startTime = session.createDateTime(startTimeStr);
endTime = session.createDateTime(endTimeStr);
result = diffInWeekdays(startTime, endTime, startTimeStr,
endTimeStr);
System.out.println("Result = " + result);
} catch(Exception e) {
e.printStackTrace();
} //NotesMain
public String diffInWeekdays(DateTime startTime, DateTime endTime, String startTimeStr, String endTimeStr) {
String res = "";
try {
Date firstDate = null, secondDate = null;
int diffInt = endTime.timeDifference(startTime);
int diffIntDays = (diffInt / 86400 + 1);
BigInteger sev = BigInteger.valueOf(7);
BigInteger minusTwo = BigInteger.valueOf(-2);
BigInteger bis = BigInteger.valueOf(getWeekday(firstDate = dateConvert(startTimeStr)));
BigInteger bie = BigInteger.valueOf(getWeekday(secondDate = dateConvert(endTimeStr)));
int strtDay = bis.mod(sev).intValue();
int endDay = bie.mod(sev).intValue();
int max = minusTwo.max(BigInteger.valueOf(strtDay * -1)).intValue();
int min = BigInteger.valueOf(1).min(bie.mod(sev)).intValue();
int result = (diffIntDays - endDay + strtDay - 8) * 5 / 7 - max - min + 5 - strtDay + endDay;
//o.println("result =\t" + result);
res = Integer.toString(result);
} catch (Exception e) {
e.printStackTrace();
return res;
} //diffInWeekdays
public java.util.Date dateConvert(String dt) { // *** changed
SimpleDateFormat sdf = new SimpleDateFormat("mm/dd/yyyy");
ParsePosition pos = new ParsePosition(0);
java.util.Date covDate = sdf.parse(dt, pos); // *** changed
return covDate;
} //dateConvert
public int getWeekday(java.util.Date cdt) { // *** changed
Calendar cal = Calendar.getInstance();
cal.setTime(cdt);
return cal.get(Calendar.DAY_OF_WEEK);
} //getWeekday
} //CalcBusinessDays -
Incompatible types in simple odbc statements
this is my simple code
import java.sql.*;
public class QueryApp {
public static void main(String a[]){
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con;
con=DriverManager.getConnection("jdbc:odbc:MyDataSource","nik","123456");
Statement stat=con.createStatement();
stat.executeQuery("Select * from Publishers");
catch(Exception e){
System.out.println("Error:"+e);
}after this when i compile i get these errors
QueryApp.java:15: incompatible types
found : java.sql.Connection
required: Connection
con=DriverManager.getConnection("jdbc:odbc:MyDataSource","nik","123456");
^
QueryApp.java:16: cannot find symbol
symbol : method createStatement()
location: class Connection
Statement stat=con.createStatement();
^
2 errorsCan some body help me on this error as searching on net wasn't fruitfull?1) You probably created a Connection class your compiler tries to use instead of java.sql.Connection. I advise to rename your class, or at least use the fully qualified classname for declaring con.
2) The Connection class you created does not have such a method. -
Incompatible types (Generics)
Can someone explain me please the following message I've got when trying to compile a file?
incompatible types
found : java.util.Iterator<E1>
required: java.util.Iterator<E1>
If the types are identical, how can they be incompatible???!!!
Thanks.Hello,
I am stuck, I have a compilation probem. I am trying to compile my torque init class, and it gave an error message says that incompatible types. I am using Vector package to check the index of an element in the array. But the compiler found List instead of vector. Can you please tell me what's wrong.
// Begin MyProject.java source
package com.digitalevergreen.mytest;
import com.digitalevergreen.mytest.om.*;
import org.apache.torque.Torque;
import org.apache.torque.util.Criteria;
import java.util.Vector;
public class MyProject
public static void main(String[] args)
try
// Initialze Torque
Torque.init( "C:/Project/torque-3.1/Project.properties" );
// Create some Authors
Author de = new Author();
de.setFirstName( "David" );
de.setLastName( "Eddings" );
de.save();
Author tg = new Author();
tg.setFirstName( "Terry" );
tg.setLastName( "Goodkind" );
tg.save();
// Create publishers
Publisher b = new Publisher();
b.setName( "Ballantine" );
b.save();
Publisher t = new Publisher();
t.setName( "Tor" );
t.save();
// Ok. For some reason even though the BaseXPeer doInsert
// methods return the primary key it is not set in the
// BaseX save method so we have to "retrieve" these objects
// from the database or we will get null value exceptions
// when we try to use them in the book objects and do a save.
Criteria crit = new Criteria();
crit.add( AuthorPeer.LAST_NAME, "Eddings" );
Vector v = AuthorPeer.doSelect( crit );
if ( v != null && v.size() > 0 )
de = (Author) v.elementAt(0);
crit = new Criteria();
crit.add( AuthorPeer.LAST_NAME, "Goodkind" );
v = AuthorPeer.doSelect( crit );
if ( v != null && v.size() > 0 )
tg = (Author) v.elementAt(0);
crit = new Criteria();
crit.add( PublisherPeer.NAME, "Ballantine" );
v = PublisherPeer.doSelect( crit );
if ( v != null && v.size() > 0 )
b = (Publisher) v.elementAt(0);
crit = new Criteria();
crit.add( PublisherPeer.NAME, "Tor" );
v = PublisherPeer.doSelect( crit );
if ( v != null && v.size() > 0 )
t = (Publisher) v.elementAt(0);
// Create books
Book wfr = new Book();
wfr.setTitle( "Wizards First Rule" );
wfr.setCopyright( "1994" );
wfr.setISBN( "0-812-54805-1" );
wfr.setPublisher( t );
wfr.setAuthor( tg );
wfr.save();
Book dof = new Book();
dof.setTitle( "Domes of Fire" );
dof.setCopyright( "1992" );
dof.setISBN( "0-345-38327-3" );
dof.setPublisher( b );
dof.setAuthor( de );
dof.save();
// Get and print books from db
crit = new Criteria();
v = BookPeer.doSelect( crit );
for ( int i = 0; i < v.size(); i++ )
Book book = (Book) v.elementAt(i);
System.out.println("Title: " + book.getTitle() );
System.out.println("Author: " +
book.getAuthor().getFirstName()
+ " " +
book.getAuthor().getLastName() );
System.out.println("Publisher: " +
book.getPublisher().getName() );
System.out.println("\n\n");
catch (Exception e)
e.printStackTrace();
// End MyProject.java source
and this is the error message:
C:\Project\torque-3.1\src\java\com\digitalevergreen\mytest>javac MyProject.java
MyProject.java:50: incompatible types
found : java.util.List
required: java.util.Vector
Vector v = AuthorPeer.doSelect( crit );
^
MyProject.java:56: incompatible types
found : java.util.List
required: java.util.Vector
v = AuthorPeer.doSelect( crit );
^
MyProject.java:62: incompatible types
found : java.util.List
required: java.util.Vector
v = PublisherPeer.doSelect( crit );
^
MyProject.java:68: incompatible types
found : java.util.List
required: java.util.Vector
v = PublisherPeer.doSelect( crit );
^
MyProject.java:93: incompatible types
found : java.util.List
required: java.util.Vector
v = BookPeer.doSelect( crit );
^
5 errors
C:\Project\torque-3.1\src\java\com\digitalevergreen\mytest>
any help will be appreciated. Thank you in advance.
Omar N. -
Sample 1:
public interface I<T extends I<?>>
I<? extends I<T>> m1 ();
public class Z<T extends I<?>> implements I<T>
public I<? extends I<T>> m1 ()
return m2();
protected I<? extends I<T>> m2 ()
return null;
javac Z.javacompiled with no problems
Sample 2:
public interface I<Tx, T extends I<Tx, ?>>
I<Tx, ? extends I<Tx, T>> m1 ();
public class Z<Tx, T extends I<Tx, ?>> implements I<Tx, T>
public I<Tx, ? extends I<Tx, T>> m1 ()
return m2();
protected I<Tx, ? extends I<Tx, T>> m2 ()
return null;
javac Z.javaZ.java:5: incompatible types
found : I<Tx,capture of ? extends I<Tx,T>>
required: I<Tx,? extends I<Tx,T>>
return m2();
^
1 error
Well... can anyone help with this? Or at least some explanations why adding second generic generates this problem?The problem is in the recursion, not in the second type argument. If you changed your first interface from
public interface I<T extends I<?>> {} to
public interface I<T extends I<T>> {} you would run into the same error message. For sake of clarity let's discuss the issue using your first example in a slightly simplified form:
public interface I<T extends I<T>> {}
public class Z<E>
public I<? extends I<E>> m1 ()
return m2();
/* error: incompatible types
found : I<capture of ? extends I<E>>
required: I<? extends I<E>>
return m2();
^
protected I<? extends I<E>> m2 ()
{ return null; }
}The error message is not awfully helpful, because the "E" is different in both types.
Method m2 returns a reference of type I<capture of ? extends I<E>>, where E extends I<capture of ? extends I<E>>, that is, it returns a concrete instantiation of the interface, namely I<SomeType> with a type that extends I<SomeType> with a type that extends ... continued recursively.
On the other hand, method m1 is supposed to return a reference of type I<? extends I<E>>, where E extends I<? extends I<E>>, that is, it returns a wildcard instantiation of the interface, namely I<? extends I<SomeType>> with a type that extends I<? extends I<SomeType>> with a type that extends ... continued recursively.
And here is the point: The first construct leads to a concrete instantiation like a List<List<List<String>>>. The second construct lead to a recursive wildcard instantiation like List<? extends List<? extends List<?>>>. As soon as the wildcard appears on a nested level, the types are no longer compatible.
It's like assigning a List<List<String>> to a List<List<?>>. It's not permitted because the first is a list of string-lists and the second is a list of mixed-lists. You cannot assign one to the other.
In your example, changing
public interface I2<Tx, T extends I2<Tx, ?>> to
public interface I2<Tx, T extends I2<?, ?>>might do the trick.
(As usual, ignore the annoying additional angle brackets.) -
Incompatible types error....plzz help
the code is
import java.util.*;
class a{
public static void main(String args[]){
LinkedList list = new LinkedList ( ) ;
list.add ( "shiva" ) ;
list.add ( "java" ) ;
list.add ( "world" ) ;
String [ ] str = list.toArray ( new String [ list.size ( ) ] ) ;
}}the error is
C:\Documents and Settings\Sumit\Desktop>javac a.java
a.java:11: incompatible types
found : java.lang.Object[]
required: java.lang.String[]
String [ ] str = list.toArray ( new String [ list.size ( ) ] ) ;
^
Note: a.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
i am not getting what's wrong with iti am not getting what's wrong with itYou're not going to like this advice, but still you must learn to help yourself. If you've not done so, please look at the API on the LinkedList toArray method. If it doesn't make sense to you, then ask specific questions about what in the API you don't understand.
-
Cannot obtain an appropriate JDBC type for class char.
The above error while deploying...The full error is below. The only datatypes used are: integer, timestamp,string, decimal and date (so no char). Can anybody help?
Caught exception during application deployment from SAP J2EE Engine's deploy service:
java.rmi.RemoteException: Cannot deploy application sap.com/SAPAS12013.. Reason: Cannot obtain an appropriate JDBC type for class char. To store the field with this class in the database, the class must implement java.io.Serializable.; nested exception is: com.sap.engine.services.deploy.container.DeploymentException: <--Localization failed: ResourceBundle='com.sap.engine.services.deploy.DeployResourceBundle', ID='com.sap.engine.services.ejb.exceptions.deployment.EJBDeploymentException: Cannot obtain an appropriate JDBC type for class char. To store the field with this class in the database, the class must implement java.io.Serializable.
at com.sap.engine.services.ejb.deploy.tools.sql.Mappings.getDefaultSqlTypeForJavaType(Mappings.java:131)
at com.sap.engine.services.ejb.deploy.xml.CMPParser.fillCmpFieldInfo(CMPParser.java:89)
at com.sap.engine.services.ejb.deploy.xml.CMPParser.parseCMPFields(CMPParser.java:644)
at com.sap.engine.services.ejb.deploy.xml.CMPParser.parseFields(CMPParser.java:121)
at com.sap.engine.services.ejb.deploy.xml.EJBJarParser.parseXml(EJBJarParser.java:173)
at com.sap.engine.services.ejb.deploy.xml.EJBJarParser.parseXml(EJBJarParser.java:97)
at com.sap.engine.services.ejb.deploy.DeployAdmin.parseSingleJar(DeployAdmin.java:296)
at com.sap.engine.services.ejb.deploy.DeployAdmin.generate(DeployAdmin.java:246)
at com.sap.engine.services.ejb.EJBAdmin.deploy(EJBAdmin.java:2118)
at com.sap.engine.services.deploy.server.application.DeploymentTransaction.makeComponents(DeploymentTransaction.java:594)
at com.sap.engine.services.deploy.server.application.DeployUtilTransaction.commonBegin(DeployUtilTransaction.java:379)
at com.sap.engine.services.deploy.server.application.DeploymentTransaction.begin(DeploymentTransaction.java:296)
at com.sap.engine.services.deploy.server.application.ApplicationTransaction.makeAllPhasesOnOneServer(ApplicationTransaction.java:290)
at com.sap.engine.services.deploy.server.application.ApplicationTransaction.makeAllPhases(ApplicationTransaction.java:323)
at com.sap.engine.services.deploy.server.DeployServiceImpl.makeGlobalTransaction(DeployServiceImpl.java:3033)
at com.sap.engine.services.deploy.server.DeployServiceImpl.deploy(DeployServiceImpl.java:463)
at com.sap.engine.services.deploy.server.DeployServiceImplp4_Skel.dispatch(DeployServiceImplp4_Skel.java:1555)
at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:294)
at com.sap.engine.services.rmi_p4.DispatchImpl._run(DispatchImpl.java:183)
at com.sap.engine.services.rmi_p4.server.P4SessionProcessor.request(P4SessionProcessor.java:119)
at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:37)
at com.sap.engine.core.cluster.impl6.session.UnorderedChannel$MessageRunner.run(UnorderedChannel.java:71)
at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
at java.security.AccessController.doPrivileged(Native Method)
at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:94)
at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:162)Hi Ashley,
And yet, apparently you have a cmp-field with type <b>char</b> in one of your CMP entity beans. This is not supported. Please refer to the <a href="http://help.sap.com/saphelp_nw04/helpdata/en/13/dbb2b66146934a9662918755038ea1/frameset.htm">Object/Relational Mapping Rules</a> and especially to the first bullet under the table.
Hope that helps!
Vladimir -
Movement type for transfer of stock from Stock-in-transit to Vendor
Hello,
Is there any movement type for transfer of stock from Stock-in-transit to Vendor.
For internal transfer from Plant to Plant we follow Purchase Requisition -> Stock Transfer Order (PO Modified) -> Delivery (VL04) -> MIGO (Goods Receipt against Delivery) method.
The problem arises when the actual delivery quantity is less then what is entered in the system (due to clerical error). That is, physically less quantity were dispatched and received at the receiving plant. Now the balance quantity is lying as stock-in-transit. To clear it we are receiving the material and using transfer posting for plant to plant transfer. Though physically there is no transfer of goods. Now we do not want to receive the material instead we want it to transfer from stock in transit to the supplying plant. Is it possible ?
Thanks.
AshishHi Ashish,
When You issue the stock, the accounting document is posted . There is no accounting entires when you do Goods receipt at receving plant . In case , we are developing to make it happen , I feel it may have impact on the Material Valuation aspects .
Hence, I feel it is better to adopt any of the following 2 options.
1) Cancellation of the entire delivery and make new delivery or 2) Receive the entire qty at the receiving plant and decide what you want to do with the unavl qty . For example in your case of loss of material due to accident , you can scrap the material in the receving plant itself or return the material back to the sending plant.
Regards
Mani
Maybe you are looking for
-
How to increase the width of the drop down list box in SSRS multi value parameter
Hi, I am using SSRS 2012. I have a parameter, which accepts multi value. The width of the drop down list box is very small, and the user need to scroll to the right to view the complete view of the content in the list box. But, if I don't use multi v
-
Getting running total formula result at the beginning of the report
Hello All, I am having an inquiry that if I can get a grand total in the report footer to the report header. The grand total is not a direct sum. I am using three formulas the first formula: @reset Group Header whileprintingrecords; numbervar sumpct
-
I work in the 29th floor or a building in downtown Chicago. For the last few days, everyone who has verizon phones have been experiencing their phones displaying the wrong date and time. Co-workers who have another carrier are not experiencing this p
-
I was having major issues with RDP 8.08 update on my IPAD in July 2014. Connect to my remote Windows 7 desktop was successful, however, screen refresh peformance was very slow and disconnects occured often. Was referred to KB2570170 and applied the
-
Can i play dota 2 on macbook pro 13 inch?
Hi im just wondering if i could play dota 2 on macbook pro 13 inch? Specs : ( my specs is just the default specs when i bought the laptop. Nothing has been chaged) 2.5 GHz Dual core i5 4gb ram 500 gb sata Another side question: What products at the a