BashPlugin For IntelliJ fails under snow leopard

I Just recently upgraded to Snow Leopard and tried to install the Bash Script plugin for intellij.

On restart, IntelliJ just did not work, even After I removed the plugin (See this post for more plugin details)

Infact it seemed to hose my current project aswell – I had to remove intellij.app and replace it with the original download (Not forgetting of course to set the JVM version

  • Share/Bookmark

@ 09:12

ides

Permalink

Java Sources (src.jar) for JDK on OSX

I just discovered that I don’t have the src.jar for my JDK installation and took a bit of ferreting about to find out that you need to download and install the JDK documentation bundle from apple developer site, aswell as the actual jdk.

You can see the thread I found here

The downloads for both the JDK and the associated documentation live here login and go to downloads. You want “Java for Mac OS X Release X” and “Java for Mac OS X Release X Developer documentation”

It then lives in (e.g) /System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home

  • Share/Bookmark

@ 10:12

code
jdk
os x

Permalink

XStream collections: when is an ArrayList not an ArrayList ?

I was just getting the following output from XStream when trying to serialize an object which has a collection property:

<addresses class="java.util.Arrays$ArrayList">
<a class="address-array">
<address>

It had to step through the code to see what was going on.

The key is in the subtlety of the type of the list that I was putting in there. Notice that actually its not an java.util.ArrayList its actually an inner class of the Arrays, called, happily $ArrayList, so I had been staring at it the whole time and not noticed.

When XStream serializes its doing the following:

        Class actualType = newObj.getClass();
        Class defaultType = mapper.defaultImplementationOf(fieldType);
        if (!actualType.equals(defaultType)) {
            String serializedClassName = mapper.serializedClass(actualType);
            if (!serializedClassName.equals(mapper.serializedClass(defaultType))) {
                String attributeName = mapper.aliasForSystemAttribute(”class”);
                if (attributeName != null) {
                    writer.addAttribute(attributeName, serializedClassName);
                 }
            }
        }

From version 1.3.1 – AbstractReflectionConverter:127

So its asking the mapper what the default implementation of the type is. The type in this case was java.util.List and the default implementation is of course java.util.ArrayList. It is not seeing java.util.Arrays$ArrayList as the same thing and so thinks it needs to specify it.

Now you might be asking, how come I have a strange inner class version of ArrayList ? Well the thing is, I thought I was being clever in the set up of my test data and im using:

       addresses = Arrays.asList(
                new AddressBuilder().addressType(”home”).streetAddress(”1 The street”).build(),
                new AddressBuilder().addressType(”work”).streetAddress(”2 The street”).build(),
                new AddressBuilder().addressType(”holiday”).streetAddress(”3 The street”).build()
        );

To set up my test data. asList does this:

 public static  List asList(T… a) {
	return new ArrayList(a);
    }
    private static class ArrayList extends AbstractList
	implements RandomAccess, java.io.Serializable
    {
        private static final long serialVersionUID = -2764017481108945198L;
	private Object[] a;

Where it uses its own implementation of ArrayList.

Phew, another fun couple of hours spent there.

  • Share/Bookmark

@ 15:11

code
java
jdk
xml

Permalink

The matching wildcard is strict, but no declaration can be found

I’ve just painfully bruised my brain against this error message when trying to validate an xml against its schema.

The problem is that it is hiding what is really going on, which is that it could not match the namespace uri in the schema document to the one in my xml document.

The xml:

<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"
      xmlns:h="http://some.custom.schema">

    <title>/v2/people/facebook.com/@self</title>
    <updated>2003-12-13T18:30:02Z</updated>

    <h:callId>b702ae86-b07f-4e2f-b49f-27d1a79b7783</h>
</feed>

The xsd

<xs:schema elementFormDefault="qualified"
                      targetNamespace="http://some.target.namespace.which.does.not.match"
                      xmlns="http://some.target.namespace.which.does.not.match"
                      xmlns:xs="http://www.w3.org/2001/XMLSchema">
</xs>

Check it.

  • Share/Bookmark

@ 12:11

xml
xsd

Permalink

DBNavigator plugin failed to start in Intellij 8.x

I just tried to use the DBNavigator plugin.

I restarted IntelliJ and it just hung there which led me on a trip to find out what was wrong.

First up I found the log files in

~/Library/Caches/IntelliJIDEA8x/log/

And saw this exception

Expected implementation for extension declaration (ep = com.intellij.completion.contributor)

This seems to be a general problem for plugins, e.g. the Scala plugin (http://youtrack.jetbrains.net/issue/SCL-1592).

So you need to remove the plugin which will have been installed here:

~/Library/Application Support/IntelliJIDEA80

Thanks to this post for triggering the solution.

  • Share/Bookmark

@ 10:11

ides

Permalink