<< Back to previous view

[CLJCLR-26] Compiler.FnOnceSym initialized in wrong order relative to _duplicateTypeMap Created: 26/Nov/13  Updated: 22/Jun/14  Resolved: 22/Jun/14

Status: Resolved
Project: ClojureCLR
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Defect Priority: Major
Reporter: David Miller Assignee: David Miller
Resolution: Completed Votes: 0
Labels: None


Noted here: https://groups.google.com/forum/#!topic/clojure/1HqVgklTb7w

From Brian Barnes:

Unfortunately, this line:

public static readonly Symbol FnOnceSym = (Symbol) Symbol.intern("fn*").withMeta(RT.map(Keyword.intern(null, "once"), true));

comes before this line:

static Dictionary<String, Type> _duplicateTypeMap = new Dictionary<string, Type>();

The evaluation of the first causes a call to the static method FindDuplicateType() within the same class, and this method uses the _duplicateTypeMap without a null check. This causes a null exception to be thrown because the initializer for _duplicateTypeMap hasn't executed yet.

My solution is to add a section at the very top of the Compiler class for "dependency" intializations - consisiting only of the initialization of _duplicateTypeMap at this point, to give a home to all such initializations that get used by the other static initializers.

Generated at Tue Oct 17 20:49:06 CDT 2017 using JIRA 4.4#649-r158309.