Lines 1355-1362
Link Here
|
1355 |
* Limitations: cannot request FIELD independently of LOCAL, or vice versa |
1355 |
* Limitations: cannot request FIELD independently of LOCAL, or vice versa |
1356 |
*/ |
1356 |
*/ |
1357 |
public Binding getBinding(char[] name, int mask, InvocationSite invocationSite, boolean needResolve) { |
1357 |
public Binding getBinding(char[] name, int mask, InvocationSite invocationSite, boolean needResolve) { |
1358 |
|
1358 |
CompilationUnitScope unitScope = compilationUnitScope(); |
|
|
1359 |
LookupEnvironment env = unitScope.environment; |
1359 |
try { |
1360 |
try { |
|
|
1361 |
env.missingClassFileLocation = invocationSite; |
1360 |
Binding binding = null; |
1362 |
Binding binding = null; |
1361 |
FieldBinding problemField = null; |
1363 |
FieldBinding problemField = null; |
1362 |
if ((mask & Binding.VARIABLE) != 0) { |
1364 |
if ((mask & Binding.VARIABLE) != 0) { |
Lines 1499-1505
Link Here
|
1499 |
|
1501 |
|
1500 |
if (compilerOptions().sourceLevel >= ClassFileConstants.JDK1_5) { |
1502 |
if (compilerOptions().sourceLevel >= ClassFileConstants.JDK1_5) { |
1501 |
// at this point the scope is a compilation unit scope & need to check for imported static fields |
1503 |
// at this point the scope is a compilation unit scope & need to check for imported static fields |
1502 |
CompilationUnitScope unitScope = (CompilationUnitScope) scope; |
|
|
1503 |
ImportBinding[] imports = unitScope.imports; |
1504 |
ImportBinding[] imports = unitScope.imports; |
1504 |
if (imports != null) { |
1505 |
if (imports != null) { |
1505 |
// check single static imports |
1506 |
// check single static imports |
Lines 1564-1572
Link Here
|
1564 |
return binding; |
1565 |
return binding; |
1565 |
// answer the problem type binding if we are only looking for a type |
1566 |
// answer the problem type binding if we are only looking for a type |
1566 |
} else if ((mask & Binding.PACKAGE) != 0) { |
1567 |
} else if ((mask & Binding.PACKAGE) != 0) { |
1567 |
CompilationUnitScope unitScope = compilationUnitScope(); |
|
|
1568 |
unitScope.recordSimpleReference(name); |
1568 |
unitScope.recordSimpleReference(name); |
1569 |
if ((binding = unitScope.environment.getTopLevelPackage(name)) != null) |
1569 |
if ((binding = env.getTopLevelPackage(name)) != null) |
1570 |
return binding; |
1570 |
return binding; |
1571 |
} |
1571 |
} |
1572 |
if (problemField != null) return problemField; |
1572 |
if (problemField != null) return problemField; |
Lines 1576-1587
Link Here
|
1576 |
} catch (AbortCompilation e) { |
1576 |
} catch (AbortCompilation e) { |
1577 |
e.updateContext(invocationSite, referenceCompilationUnit().compilationResult); |
1577 |
e.updateContext(invocationSite, referenceCompilationUnit().compilationResult); |
1578 |
throw e; |
1578 |
throw e; |
|
|
1579 |
} finally { |
1580 |
env.missingClassFileLocation = null; |
1579 |
} |
1581 |
} |
1580 |
} |
1582 |
} |
1581 |
|
1583 |
|
1582 |
public MethodBinding getConstructor(ReferenceBinding receiverType, TypeBinding[] argumentTypes, InvocationSite invocationSite) { |
1584 |
public MethodBinding getConstructor(ReferenceBinding receiverType, TypeBinding[] argumentTypes, InvocationSite invocationSite) { |
|
|
1585 |
CompilationUnitScope unitScope = compilationUnitScope(); |
1586 |
LookupEnvironment env = unitScope.environment; |
1583 |
try { |
1587 |
try { |
1584 |
CompilationUnitScope unitScope = compilationUnitScope(); |
1588 |
env.missingClassFileLocation = invocationSite; |
1585 |
unitScope.recordTypeReference(receiverType); |
1589 |
unitScope.recordTypeReference(receiverType); |
1586 |
unitScope.recordTypeReferences(argumentTypes); |
1590 |
unitScope.recordTypeReferences(argumentTypes); |
1587 |
MethodBinding methodBinding = receiverType.getExactConstructor(argumentTypes); |
1591 |
MethodBinding methodBinding = receiverType.getExactConstructor(argumentTypes); |
Lines 1636-1641
Link Here
|
1636 |
} catch (AbortCompilation e) { |
1640 |
} catch (AbortCompilation e) { |
1637 |
e.updateContext(invocationSite, referenceCompilationUnit().compilationResult); |
1641 |
e.updateContext(invocationSite, referenceCompilationUnit().compilationResult); |
1638 |
throw e; |
1642 |
throw e; |
|
|
1643 |
} finally { |
1644 |
env.missingClassFileLocation = null; |
1639 |
} |
1645 |
} |
1640 |
} |
1646 |
} |
1641 |
|
1647 |
|
Lines 1680-1686
Link Here
|
1680 |
} |
1686 |
} |
1681 |
|
1687 |
|
1682 |
public FieldBinding getField(TypeBinding receiverType, char[] fieldName, InvocationSite invocationSite) { |
1688 |
public FieldBinding getField(TypeBinding receiverType, char[] fieldName, InvocationSite invocationSite) { |
|
|
1689 |
LookupEnvironment env = environment(); |
1683 |
try { |
1690 |
try { |
|
|
1691 |
env.missingClassFileLocation = invocationSite; |
1684 |
FieldBinding field = findField(receiverType, fieldName, invocationSite, true /*resolve*/); |
1692 |
FieldBinding field = findField(receiverType, fieldName, invocationSite, true /*resolve*/); |
1685 |
if (field != null) return field; |
1693 |
if (field != null) return field; |
1686 |
|
1694 |
|
Lines 1691-1697
Link Here
|
1691 |
} catch (AbortCompilation e) { |
1699 |
} catch (AbortCompilation e) { |
1692 |
e.updateContext(invocationSite, referenceCompilationUnit().compilationResult); |
1700 |
e.updateContext(invocationSite, referenceCompilationUnit().compilationResult); |
1693 |
throw e; |
1701 |
throw e; |
1694 |
} |
1702 |
} finally { |
|
|
1703 |
env.missingClassFileLocation = null; |
1704 |
} |
1695 |
} |
1705 |
} |
1696 |
|
1706 |
|
1697 |
/* API |
1707 |
/* API |
Lines 1981-1995
Link Here
|
1981 |
} |
1991 |
} |
1982 |
|
1992 |
|
1983 |
public MethodBinding getMethod(TypeBinding receiverType, char[] selector, TypeBinding[] argumentTypes, InvocationSite invocationSite) { |
1993 |
public MethodBinding getMethod(TypeBinding receiverType, char[] selector, TypeBinding[] argumentTypes, InvocationSite invocationSite) { |
|
|
1994 |
CompilationUnitScope unitScope = compilationUnitScope(); |
1995 |
LookupEnvironment env = unitScope.environment; |
1984 |
try { |
1996 |
try { |
|
|
1997 |
env.missingClassFileLocation = invocationSite; |
1985 |
switch (receiverType.kind()) { |
1998 |
switch (receiverType.kind()) { |
1986 |
case Binding.BASE_TYPE : |
1999 |
case Binding.BASE_TYPE : |
1987 |
return new ProblemMethodBinding(selector, argumentTypes, ProblemReasons.NotFound); |
2000 |
return new ProblemMethodBinding(selector, argumentTypes, ProblemReasons.NotFound); |
1988 |
case Binding.ARRAY_TYPE : |
2001 |
case Binding.ARRAY_TYPE : |
1989 |
compilationUnitScope().recordTypeReference(receiverType); |
2002 |
unitScope.recordTypeReference(receiverType); |
1990 |
return findMethodForArray((ArrayBinding) receiverType, selector, argumentTypes, invocationSite); |
2003 |
return findMethodForArray((ArrayBinding) receiverType, selector, argumentTypes, invocationSite); |
1991 |
} |
2004 |
} |
1992 |
compilationUnitScope().recordTypeReference(receiverType); |
2005 |
unitScope.recordTypeReference(receiverType); |
1993 |
|
2006 |
|
1994 |
ReferenceBinding currentType = (ReferenceBinding) receiverType; |
2007 |
ReferenceBinding currentType = (ReferenceBinding) receiverType; |
1995 |
if (!currentType.canBeSeenBy(this)) |
2008 |
if (!currentType.canBeSeenBy(this)) |
Lines 2016-2021
Link Here
|
2016 |
} catch (AbortCompilation e) { |
2029 |
} catch (AbortCompilation e) { |
2017 |
e.updateContext(invocationSite, referenceCompilationUnit().compilationResult); |
2030 |
e.updateContext(invocationSite, referenceCompilationUnit().compilationResult); |
2018 |
throw e; |
2031 |
throw e; |
|
|
2032 |
} finally { |
2033 |
env.missingClassFileLocation = null; |
2019 |
} |
2034 |
} |
2020 |
} |
2035 |
} |
2021 |
|
2036 |
|