|Re: [jdt-dev] Prebuilt indexes for JDK/JRE|
On Tue, 2020-12-22 at 12:04 +0100, Gayan Perera wrote:
> Hi JDT Friends,
> While going through the JDT code i found the following feature
> flag org.eclipse.jdt.internal.core.search.indexing.IndexManager.IS_MA
> When searching around I also found some bugs which focus on adding
> pre-built JDT indexes into JDT.
> Does this mean JDT is capable of using pre-built indexes for JDT
> search for JDKs ?
Yes, but likely requires some setup as it isn't done by default. As an
example, I'm pretty sure if you took an existing index file for a
library on a certain path, and dropped it in
$WORKSPACE/.metadata/.plugins/org.eclipse.jdt.core/ , it might work.
The way this works, I believe, if a java library (eg. jar) does not
have an IClasspathAttribute.INDEX_LOCATION_ATTRIBUTE_NAME property set,
then the index file will be the CRC32 checksum of the library path. I'd
look in ClasspathEntry.java for more details on this.
With https://eclip.se/515268 , I added the ability to set a common
location that may be used by many different instances of Eclipse. This
approach would work nicely where you have a large set of well known
libraries that are unlikely to change, and would prefer to not have
clients indexing them locally every time. The indexing is not thread-
safe though so multiple clients writing to a common location is not
Combining some of these features, it could be possible to have some
kind of shared filesystem (read-only) for resolving index files.
> If so is there any service that is built around downloading pre-built
> indexes ?
I found something that might have worked at some point, but had some
issues, so I didn't investigate further. I can't remember if I used
INDEX_LOCATION_ATTRIBUTE_NAME on a particular library or
SHARED_INDEX_LOCATION, but I was able to have it recognize :
jar:http://localhost:8080/1558221869.jar!/1558221869.index as an
(where 1558221869.jar contained 1558221869.index and was hosted on a
local web server)
However, it ultimately failed in reading from the location due to
AIOOBE in some read calls. If anyone wanted to have some kind of
indexing over http, fixing this up might be a possibility.
> Also are there any standalone tools that can be used to create JDT
> indexes ?
Yes. See JavaIndexerApplication  . This can be run as a headless
Hope this helps,
jdt-dev mailing list
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/jdt-dev
Back to the top