Log of the #nice channel on irc.freenode.net

* arjanb joins12:01
* alexgreif joins18:58
hi arjan
the following code does not compile:18:59
package test;
class test {
void doTest() {}
class test2 {
void doTest2() {}
the nicec message is:
./test/test.nice: line 7, column 3:
Ambiguity for symbol this. Possibilities are :
test.test2 this
test.test this
<arjanb>hello alex i was away19:15
is this with the latest development version?19:16
Nice compiler version 0.9.1 prerelease (build 2003.07.26, 14:08:22 UTC)19:20
is this a bug, or is "this" not allowed in the initializer?19:21
<arjanb>i think it's a bug19:23
but you can workaround it:19:33
class test2 {
let test2 _this = this;
void doTest2() {}
<alexgreif>ok, thats good
btw: what is the difference between "let" and "var"?19:34
<arjanb>try to assign to them a second time
<alexgreif>so let is a constant19:35
<alexgreif>can both be in package scope?
and also any other scope?
but if you use them at toplevel the type is always required19:37
<alexgreif>otherwise not? cool!19:38
<arjanb>not always the compiler can only infer monotypes yet19:39
let arr = [1,2,3]; doesn't get accepted19:41
<alexgreif>I see
<arjanb>but how is the plugin going?19:45
<alexgreif>Im currently at the part to create a nice project. but have a strange problem:19:46
Unhandled exception caught in event loop.19:48
tried to access method org.eclipse.ui.wizards.newresource.BasicNewResourceWizard.selectAndReveal(Lorg/eclipse/core/resources/IResource;)V from class net.sf.nice.ui.wizards.fun
as always eclipse does not say much about the problem
<arjanb>what are the modifiers of that method?19:49
<alexgreif>the strange thing is that existing java code uses the selectAndReveal method in the same way
aaah, protected void19:50
but Im in an extended class
<arjanb>yes but methods are not always inside the class in nice
<alexgreif>oops that is said by "from class net.sf.nice.ui.wizards.fun"19:51
hm... what can I do?
I could use a workaround: 19:52
static void selectAndReveal(IResource??resource, IWorkbenchWindow??window)
<arjanb>i think there's a better way19:53
<alexgreif>the eclipse source is like:
protected void selectAndReveal(IResource newResource) {
selectAndReveal(newResource, getWorkbench().getActiveWorkbenchWindow());
what would be the better way?
<arjanb>in the nice class that extends the eclipse class you add the following:19:54
selectAndReveal(resource) {19:55
<alexgreif>Im running it ...19:57
... yes it worked! THANKS!!!19:58
maybe it possible to make the compiler insert this redirection automaticly when you try call a protected java method20:04
<alexgreif>yes, but maybe an info should be reported to the user.20:18
<arjanb>why should it be reported to the user the problem is only caused by how the nicec compiles things20:24
<alexgreif>maybe you are right, the user should not concern about this.21:16
the compiler complains with the following:22:11
class NiceElementAdapterFactory implements IAdapterFactory {
let Class[] ADAPTERS_I_CREATE = new Class[] {
the compiler message is: 22:12
Encountered "let".
Was expecting one of:
"(" ...
"{" ...
"}" ...
I also tried : let Class[] ADAPTERS_I_CREATE = [IResource.class];22:14
but the same compiler message
<arjanb>for fields you should use final22:16
<alexgreif>final Class[] ADAPTERS_I_CREATE = [IResource.class]; ?22:17
Q: I have a java interface that declares the method Object getAdapter(...); if I implement this java interface in a nice class and implement the method like getAdapter(...) {.....return null;)22:27
then the compliler complains with:
null might be null
<arjanb>the return type doesn't allow null i think22:29
<alexgreif>should I use cast(null) ?22:30
<arjanb>or better you retype the getadapter function
<alexgreif>is cast(null) equivalent with "null" in java or is it an Object?
<arjanb>cast(null) is exactly the same as null in java22:32
<alexgreif>I try retyping...
yes retyping worked finr with:22:35
?Object getAdapter(IAdapterFactory, Object, Class)
= native Object IAdapterFactory.getAdapter(Object, Class);
<arjanb>Object isn't really a type in Nice22:36
<alexgreif>but is my retyping correct?22:37
<arjanb>are the two object types related?
<alexgreif>javadoc says:22:38
Object getAdapter(Object??adaptableObject, Class??adapterType)
????????????????????Returns an object which is an instance of the given class associated with the given object.
with related you mean, the same object?22:39
<arjanb>a related type
a better version of the retyping you showed is:22:42
<?T, !U> T getAdapter(IAdapterFactory, U, Class) = native ...
<alexgreif>the getAdapter method does the following:
getAdapter(adaptableObject, adapterType) {
INiceElement niceElement = cast(adaptableObject);
if (IResource.class.equals(adapterType))
return cast(this.getResource(niceElement));
return null;
has INiceElement a superclass?22:45
<alexgreif>for me too, I dont quite understand this Adapter stuff in eclipse :(
interface INiceElement {...}22:46
it has no super interface
<arjanb>you could try this one <?T> T getAdapter(IAdapterFactory, INiceElement, Class) = native ...22:47
then you should be able to remove the casts
<alexgreif>Encountered "?".22:49
Was expecting one of:
"!" ...
"Any" ...
<IDENT> ...
<arjanb>oops <T> ?T
<alexgreif>I tried to remove the cast in the return statement, but then:22:51
Incorrect return type:
Found : org.eclipse.core.resources.IResource
Expected: ?T
<arjanb>so it returns allways an IResource?22:52
<alexgreif>the decal is :
Object getAdapter(Object adaptableObject, Class adapterType)
<arjanb>you could use this for as long as it works: ?IResource getAdapter(IAdapterFactory, INiceElement, Class) = native ...22:53
<alexgreif>now it compiles; I removed the two casts and used as retyping: ?IResource getAdapter(...22:56
<arjanb>ok where can i find the api docs for these eclipse things22:57
it seem to me that they use Object too often as type22:58
<alexgreif>I have them locally, but I search for them... wait22:59
i don't like these docs: Parameters:
adaptableObject - the adaptable object being queried (usually an instance of IAdaptable)
<alexgreif>I cant help it :)23:07
<arjanb>does INiceElement implements IAdaptable?23:08
interface INiceElement {...}
it has no super interface
<arjanb>these docs suggest that it should implement Iadaptable23:11
<alexgreif>you mean extend?23:12
<alexgreif>hm. the fully java plugin had the same interface also without extend ..23:13
<arjanb>it's not needed i think they say "(usually an instance of IAdaptable)"23:14
<alexgreif>for me this Adaptable stuff is confusing. 23:17
<arjanb>isn't that a so called "designpattern"23:20
<alexgreif>dont ask me :))23:21
<arjanb>google has many links to such things: http://www.exciton.cs.rice.edu/JavaResources/DesignPatterns/adapter.htm23:24
<alexgreif>I will have to read about it. Maybe its good to know that they exist23:25
I have a problem with the switch syntax:
switch (resource.getType()) {...
Encountered "{".
Was expecting one of:
";" ...
"=" ...
<assignmentOperator> ...
"++" ...
"--" ...
<arjanb>nice doesn't have a switch
<alexgreif> "[" ...23:27
"." ...
"(" ...
do I have to use if-then-else or is there a nicer substitute?
<arjanb>no, you can use multimethods23:28
what does getType() return?
switch (resource.getType()) {
case IResource.FILE :
return resource.getParent();
case IResource.FOLDER :
case IResource.PROJECT :
case IResource.ROOT :
return cast(resource);
default :
<arjanb>hmm IResource is a java interface otherwise you could use enums23:31
in case are if statements easier23:33
<alexgreif>I think so too
<arjanb>you can't use switch here even in jave because these values are bitmasks23:48
<alexgreif>hmm, the code was copied from the ruby eclipse plugin.23:50
<alexgreif>I have another strange compiler issue:
package test;
class Test {
final Class[] classes = [Test.class, Test2.class];
class Test2 {}
./test/test.nice: line 3, column 34:
Test is not declared
if the class is in another package then the declaration is found!00:22
only the own package has problems to find class decl's
<arjanb>looks like a little bug00:24
<alexgreif>I have to go now, please write in irc when the bugfix will be available. Thanks. I'll check the logs00:29
cu, good night
* alexgreif leaves

Generated by Sualtam