Systems and methods for handling renaming of programming constructs in programming environments
AssigneeThe MathWorks, Inc.
InventorsJennifer Black, Xiao Xu, David Foti
Life of this patent
Estimating the term…
Abstract
Apparatus and methods are described for adapting a programming environment to handle renamed programming constructs such as classes and packages. Non-canonical identifiers that reference renamed programming constructs can be used in code parts to be executed in the programming environment, and the code parts can execute, without disruption or user intervention, using related canonical identifiers. The solutions described herein provide backward and forward compatibility for code and data affected by renaming of programming constructs.
Claims20
A method of providing backward and forward compatibility of code or data that references a renamed programming construct, the method comprising:
- detecting, by a processor of a computing system, a first mapping between one or more non-canonical identifiers for a programming construct and a canonical identifier for the programming construct, the first mapping being stored in source code, metadata associated with source code, or object code;
- parsing the first mapping;
- generating an identifier map based at least in part on information parsed from the first mapping, wherein the identifier map includes at least the canonical identifier and associates the canonical identifier with the one or more non-canonical identifiers;
- at run-time of the code or load operation of the data, detecting an unknown referencing identifier for the programming construct;
- in response to detecting the unknown referencing identifier;
- accessing the identifier map;
- determining from the identifier map that a non-canonical identifier of the one or more non-canonical identifiers matches the unknown referencing identifier and is associated with the canonical identifier;
- and
- executing the code using the canonical identifier without entering an error state,
- wherein the act of executing the code comprises replacing, in the code, the unknown referencing identifier with the canonical identifier or generating a code Dart that replicates a portion of the code with the unknown referencing identifier replaced by the canonical identifier or redirecting a code reference to the programming construct from the unknown referencing identifier to the canonical identifier, and
- wherein a version of a programming environment that executes the code is a version that predates or postdates renaming of the programming construct from the non-canonical identifier to the canonical identifier.
A computing system that supports a programming environment, the system comprising:
- at least one processor in communication with first memory and rapid access memory;
- code-execution components;
- an aliasing parser;
- and
- a path manager, the programming environment configured to:
- detect, by the aliasing parser, a first mapping between one or more non-canonical identifiers for a programming construct and a canonical identifier for the programming construct, the first mapping being stored in source code, metadata associated with source code, or object code in the first memory;
- parse, by the aliasing parser, the first mapping;
- generate an identifier map in the rapid access memory based at least in part on information parsed from the first mapping, wherein the identifier map includes at least the canonical identifier and associates the canonical identifier with the one or more non-canonical identifiers;
- at run-time of code or load operation of data in the programming environment, detect, by at least one of the code-execution components, an unknown referencing identifier for the programming construct;
- in response to detecting the unknown referencing identifier:
- initiate interrogation of the identifier map;
- identify from the identifier map that a non-canonical identifier of the one or more non-canonical identifiers matches the unknown referencing identifier and is associated with the canonical identifier;
- and
- execute, by the code-execution components, the code without entering an error state,
- wherein the act of executing the code comprises replacing, in the code, the unknown referencing identifier with the canonical identifier or generating a code Dart that replicates a portion of the code with the unknown referencing identifier replaced by the canonical identifier or redirecting a code reference to the programming construct from the unknown referencing identifier to the canonical identifier, and
- wherein a version of a programming environment that executes the code is a version that predates or postdates renaming of the programming construct from the non-canonical identifier to the canonical identifier.
A non-transitory computer-readable medium encoding code that, when executed by at least one processor of a computing system, adapt the at least one processor to:
- detect a mapping between one or more non-canonical identifiers for a programming construct and a canonical identifier for the programming construct, the mapping being stored in source code, metadata associated with source code, or object code;
- parse the mapping;
- generate an identifier map based at least in part on information parsed from the mapping, wherein the identifier map includes at least the canonical identifier and associates the canonical identifier with the one or more non-canonical identifiers;
- at run-time of code or load operation of data, detect an unknown referencing identifier for the programming construct;
- in response to detecting the unknown referencing identifier:
- access the identifier map;
- determine from the identifier map that a non-canonical identifier of the one or more non-canonical identifiers matches the unknown referencing identifier and is associated with the canonical identifier;
- and
- execute the code without entering an error state,
- wherein the act of executing the code comprises replacing, in the code, the unknown referencing identifier with the canonical identifier or generating a code part that replicates a portion of the code with the unknown referencing identifier replaced by the canonical identifier or redirecting a code reference to the programming construct from the unknown referencing identifier to the canonical identifier, and
- wherein a version of a programming environment that executes the code is a version that predates or postdates renaming of the programming construct from the non-canonical identifier to the canonical identifier.
Dependencies are inferred from the claim text.