option java_package = "fi.kapsi.koti.jpa.nanopb";
Or the same with your choice of non-empty package! This then generates Java code that works fine.
I don't think this has any bad side-effects, would it be worth including this in Nanopb by default?
I'll have a go at explaining, it's actually the first time I've run into this kind of thing; it's a bit unusual to have code in the default package, so I also had to look it up to work out what is going on!
Normally any Java class will be in a named package, often a "backwards domain name" like "org.someproject.somepackage". It's also possible to have no package declaration at all, which gives you the "default" package, essentially an empty package name.
However this is deprecated and strongly discouraged, since it tends to pollute the namespace. In fact it is now apparently not possible for classes in a named package to import classes from the default package:
http://stackoverflow.com/questions/2030148/whats-the-syntax-to-import-a-class-in-a-default-package-in-java
When protobuf generates the java class for a .proto with no package or java_package specified, it puts the output java class in the default package. This happens to the nanopb.proto, generating a class Nanopb.java with no package declaration. If you also have a "foo.proto" file with package or java_package set to "bar" then you will also get a foo.java file in the bar package. This foo.java file will try to reference Nanopb.java for the extension stuff. Because of the restriction on importing from the default package, this generates a compile error. If the Nanopb.java file lives in a named package, everything seems to work fine.
Things should also work if none of the .proto files specifies a package or java_package, since everything will then be in the default package, and apparently this will work. However it's also far from ideal, since the default package is deprecated.