Feb 26, 2019, 11:10:15 AM (4 years ago)
Nicklas Nordborg

References #2151: Pre-compile all JSP pages before releases

Getting rid of a lot of unchecked warnings. Most of them are solved by changed the API in several BASE core clases to use implict casting of return types instead of explicit (this moved the 'unchecked' warning to the API method from the caller). Example:

// Before
ItemContext cc = ...
Hardware hardware = (Hardware)cc.getObject("item");

// After
Hardware hardware = cc.getObject("item");

In most cases both the old and new version of the code will work, but if the returned object is using a "type" parameter it will not compile:

// This will not compile!
Set<AnnotatedItem> items = (Set<AnnotatedItem>)cc.getObject("AnnotatedItems");

// But this will!
Set<AnnotatedItem> items = cc.getObject("AnnotatedItems");

Note that existing compiled code will still work, but that some changes may be needed when compiling agains BASE 3.15. The issues should be easy to solve (eg. remove an explict cast).

Extensions that uses JSP files that works in BASE 3.14 may stop working in BASE 3.15 since the compilation of the JSP files happens on the BASE server as they are accessed.

Another issues is that there are still a lot of unchecked warnings related to the JSON library. This build on regular Map and List API:s but has not specified generic type parameters so there is no way to get rid of those warnings without fixing the JSON library source code. The latest released version is from 2012 so it is not likely that this should happen unless we do it ourselves (the warnings are really annoying so maybe we should!).

1 edited


  • trunk/www/common/overview/info.jsp

    r7604 r7605  
    132132  JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, null, node);
    133   ExtensionsInvoker<SectionAction> invoker = (ExtensionsInvoker<SectionAction>)ExtensionsControl.useExtensions(
     133  ExtensionsInvoker<SectionAction> invoker = ExtensionsControl.useExtensions(
    134134      jspContext, "net.sf.basedb.clients.web.overview.info-details");
    437437                // Unit and formatter for the values
    438                 @SuppressWarnings("rawtypes")
    439                 Formatter formatter = FormatterFactory.getTypeFormatter(sc, at.getValueType());
     438                Formatter<Object> formatter = FormatterFactory.getTypeFormatter(sc, at.getValueType());
    440439                Unit unit = snapshot.getActualUnit(dc);
    441440                UnitConverter converter = null;
Note: See TracChangeset for help on using the changeset viewer.