Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #23816
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.datemas.de!rt.uk.eu.org!aioe.org!.POSTED!not-for-mail |
|---|---|
| From | qwertmonkey@syberianoutpost.ru |
| Newsgroups | comp.lang.java.programmer |
| Subject | cannot find symbol? |
| Date | Sat, 4 May 2013 04:01:44 +0000 (UTC) |
| Organization | Aioe.org NNTP Server |
| Lines | 110 |
| Message-ID | <km2178$3h2$1@speranza.aioe.org> (permalink) |
| NNTP-Posting-Host | jcJFTAhAdFLWfAXONlzC5w.user.speranza.aioe.org |
| X-Complaints-To | abuse@aioe.org |
| X-Notice | Filtered by postfilter v. 0.8.2 |
| X-Newsreader | NetComponents |
| Xref | csiph.com comp.lang.java.programmer:23816 |
Show key headers only | View raw
Basically I am passing a String array to a method (verify) defined in a
generic way in an interface in order to create an object of a certain type
I am checking that the object of the correct type is created but when I try
to call a method java tells me "cannot find symbol"
I squinted at it for a while, but can't see what is wrong with it
What is wrong with this code? How do you fix that problem? Does it relate
to the use of generic declarations and/or reflection?
thanks,
lbrtchx
comp.lang.java.programmer: cannot find symbol?
// ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
import java.util.Date;
import java.io.IOException;
import java.lang.reflect.Method;
import java.lang.reflect.InvocationTargetException;
// __ mock/test object
class IADObj{
private int d;
private String aS;
private Date Dt;
// __
IADObj(){}
// __
public void setCtxt(int d, String aS, long lTm){
this.d = d;
this.aS = aS;
this.Dt = new Date(lTm);
}
// __
public String toString(){ return("// __ d: |" + d + "|, aS: |" + aS +
"|, Dt: |" + Dt + "|"); }
}
// __
interface verifiableCLIContext06<T_Ctxt>{
public boolean verifyCtxt(String[] aSArs, Class<? extends T_Ctxt> TpArgK);
public T_Ctxt getCtxtDTO();
}
// __
class DTO_T_Ctxt06<T_Ctxt> implements verifiableCLIContext06<T_Ctxt> {
private T_Ctxt tCtxt; // operating context
// __
DTO_T_Ctxt06(){ System.err.println("// __ object created: |" +
getTimeStamp() + "|"); }
// __
private String getTimeStamp(){ return((new Date()).toString()); }
// __
public boolean verifyCtxt(String[] aSAr, Class<? extends T_Ctxt> TpArgK){
int iArSz= Integer.MIN_VALUE;
boolean Is = ((aSAr != null) && ((iArSz = aSAr.length) > 0));
if(Is){
for(int i = 0; (i < iArSz); ++i){
System.err.println("// __ aSAr[" + i + "]: |" + aSAr[i] + "|");
}
// __
try{
tCtxt = (T_Ctxt)TpArgK.newInstance();
System.err.println("// __ tCtxt.getClass(): |" + tCtxt.getClass() + "|");
/*
tCtxt.setCtxt((new Integer(aSAr[0])).intValue(), aSAr[1],
(new Long(aSAr[0])).longValue());
cannot find symbol
symbol : method setCtxt(int,java.lang.String,long)
location: class java.lang.Object
tCtxt.setCtxt((new Integer(aSAr[0])).intValue(), aSAr[1],
(new Long(aSAr[0])).longValue());
^
*/
}catch(InstantiationException InstX){ InstX.printStackTrace(System.err); }
catch(IllegalAccessException IlglAxX){ IlglAxX.printStackTrace(); }
}// (Is)
// __
return(Is);
}
// __
public T_Ctxt getCtxtDTO(){ return(tCtxt); }
}
// __
public class DTO_T_Ctxt06Test{
public static void main(String[] args) {
IADObj IAD = new IADObj();
String[] aSAr = new String[]{"37", "abc", (new Date()).toString()};
DTO_T_Ctxt06<IADObj> DTO_T_Ctxt06 = new DTO_T_Ctxt06<IADObj>();
DTO_T_Ctxt06.verifyCtxt(aSAr, IAD.getClass());
}
}
// ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
Back to comp.lang.java.programmer | Previous | Next — Next in thread | Find similar | Unroll thread
cannot find symbol? qwertmonkey@syberianoutpost.ru - 2013-05-04 04:01 +0000
Re: cannot find symbol? Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2013-05-03 21:54 -0700
Re: cannot find symbol? lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-05-04 09:16 +0100
Re: cannot find symbol? Joerg Meier <joergmmeier@arcor.de> - 2013-05-04 14:49 +0200
Re: cannot find symbol? Eric Sosman <esosman@comcast-dot-net.invalid> - 2013-05-04 09:14 -0400
Re: cannot find symbol? Arved Sandstrom <asandstrom2@eastlink.ca> - 2013-05-06 05:42 -0300
Re: cannot find symbol? Arne Vajhøj <arne@vajhoej.dk> - 2013-05-04 21:31 -0400
Re: cannot find symbol? markspace <markspace@nospam.nospam> - 2013-05-04 18:34 -0700
Re: cannot find symbol? Robert Klemme <shortcutter@googlemail.com> - 2013-05-05 13:09 +0200
csiph-web