jsr107 / jsr107spec

JSR107 Cache Specification
Apache License 2.0
413 stars 164 forks source link

Classloading: CachingProvider.getDefaultClassloader #353

Open cruftex opened 8 years ago

cruftex commented 8 years ago

Most implementations I analyzed, including the RI, use the following as default classloader:

public ClassLoader getDefaultClassLoader() {
   return getClass().getClassLoader();
}

Alternatives, I can think of, which are legal at the moment as well:

Possibly will an implementation pass the TCK tests which decides for the TCCL as default. We should be more strict here, so users know precisely when to set the custom class loader.

The basic goal is that implementations should behave consistent.

cruftex commented 8 years ago

At the moment I think the best way is to make the RI default mandatory.

jerrinot commented 7 years ago

Is TCCL a good option for a default classloader? The spec currently says:

Obtains the default ClassLoader that will be used by the CachingProvider

This is hard to guarantee with TCCL - it depends on context (by its very definition)