A Comprehensive Approach to Naming and Accessibility in Refactoring Java Programs
- 格式:pdf
- 大小:3.51 MB
- 文档页数:25
六要素整合的英语课程内容英文版Six Elements Integration in English CurriculumEnglish curriculum is an important part of modern education, emphasizing on both language skills and communicative abilities. The six elements integration in English curriculum offers a systematic and comprehensive approach to learning, which includes aims, content, teaching methods, learning resources, assessment, and reflection.Aims: The aims of the English curriculum are to enable students to develop their language ability in listening, speaking, reading, writing, and thinking. Moreover, they are to improve their communicative competence and intercultural awareness, thus preparing them for academic and social use of the language in the future.Content: The content of the English curriculum consists of four areas: language structures, language functions, language skills, and language knowledge. These four areas interact with each other in a spiral manner, building students' language proficiency systematically and steadily.Teaching methods: The teaching methods in the English curriculum emphasize both teacher-centered and student-centered approaches. The teacher-centered approach focuses on the explicit instruction of language knowledge and skill development, while the student-centered approach focuses on students' active participation and interaction incommunicative activities, creating a student-centered classroom.Learning resources: The learning resources in the English curriculum consist of diverse materials and activities, suchas textbooks, videos, movies, songs, games, and so on. These resources have been designed to meet the needs of learners at different levels and to support their learning in a comprehensive way.Assessment: The assessment in the English curriculum includes four aspects: formative assessment, summative assessment,self-assessment, and peer assessment. All these assessments enable learners to reflect on their learning progress and to identify areas that need further improvement.Reflection: Reflection is an important part of the English curriculum, which enables students to reflect on their own learning experiences and to identify effective learning strategies. It enhances students' self-awareness and provides them with better control over their learning.In conclusion, the six elements integration in English curriculum provides a comprehensive approach to learning, which promotes language development, communicative competence, and intercultural awareness, and prepare students for academic and social use of the language in the future.。
职业健康和安全管理体系英文Occupational Health and Safety Management System (OHSMS)is a comprehensive approach to managing occupational health and safety issues in the workplace. The system aims to reduce the risk of accidents and illnesses by promoting a safe and healthy working environment.The OHSMS is based on the principles of continuous improvement and focuses on identifying and controlling hazards, assessing risks, and improving safety performance. The system includes policies, procedures, and practicestailored to the needs of the organization.Benefits of OHSMSImplementing an effective OHSMS can bring significant benefits to organizations. These benefits include:1. Improved safety performance: The OHSMS helps identify hazards and assess risks, leading to the implementation of measures that reduce the likelihood of accidents and injuries. This, in turn, leads to improved safety performance, reduced absenteeism, and health care costs.2. Compliance with regulations: The OHSMS helps organizations meet legal requirements related to occupationalhealth and safety. It ensures that the organization is in compliance with applicable laws and regulations, reducing the risk of legal action and penalties.3. Improved reputation: Implementing an OHSMS send a message to stakeholders that the organization is serious about safety and health. It enhances the reputation of the organization, which can attract customers, investors, and talent.4. Increased productivity: A safe and healthy working environment can improve productivity by reducing absenteeism, worker turnover, and injury-related costs.Component of OHSMSAn OHSMS consists of several components, including:1. Policy: The OHSMS policy outlines the organization's commitment to managing occupational health and safety. It defines the roles and responsibilities of employees, management, and other stakeholders.2. Planning: The planning stage involves identifying hazards and assessing risks, setting objectives and targets, and developing action plans to achieve them.3. Implementation: The implementation stage involves putting the plans into practice, including the implementation of policies, procedures, and training programs.4. Measurement and evaluation: The OHSMS measures and evaluates the effectiveness of the program. This involves monitoring and evaluating progress against objectives, identifying areas for improvement, and implementingcorrective action.5. Review: The review stage involves regularly reviewing the OHSMS to ensure it is up-to-date, effective, and meets regulation requirements.ConclusionAn effective OHSMS can bring significant benefits to an organization, including improved safety performance, compliance with regulations, a better reputation, and increased productivity. Organizations can implement an OHSMS by following the key components, including policy, planning, implementation, measurement, evaluation, and review. By prioritizing health and safety, organizations can create a positive working environment that benefits both employees and the organization.。
中式英语作文考研真题In the contemporary era, the integration of traditional Chinese medicine (TCM) into modern healthcare practices has become increasingly prevalent. TCM, with its holisticapproach and emphasis on prevention, offers a unique perspective on health and wellness that complements the more symptomatic treatment methods of Western medicine.TCM encompasses a variety of practices, including acupuncture, herbal medicine, massage (Tui Na), dietary therapy, and Qigong. These methods have been used for thousands of yearsto diagnose and treat a wide range of conditions. The fundamental principles of TCM are based on the concept of Qi (vital energy), Yin and Yang (opposing forces), and the Five Elements theory, which are used to understand the body's functions and imbalances.One of the key advantages of TCM is its focus on the balance and harmony of the body's systems. Unlike Western medicine, which often treats symptoms, TCM seeks to address the root causes of illness by restoring the body's natural balance.This is particularly beneficial for chronic conditions, where Western treatments may only offer temporary relief.Herbal medicine is a significant aspect of TCM, withthousands of herbs used for their therapeutic properties. These herbs are carefully selected and combined based on the individual's constitution and the specific condition beingtreated. The use of herbs allows for a personalized approachto treatment, which can be more effective than one-size-fits-all Western medications.Acupuncture, another cornerstone of TCM, involves theinsertion of thin needles into specific points on the body to regulate the flow of Qi and blood. This practice has been shown to be effective in treating pain, stress, and various other conditions. The non-invasive nature of acupuncture makes it an appealing option for those who prefer alternative therapies.In recent years, there has been a growing interest in the scientific validation of TCM practices. Numerous studies have demonstrated the efficacy of TCM in treating various ailments, leading to a greater acceptance of these practices in the global healthcare community. However, it is important to note that TCM should not be seen as a replacement for Western medicine but rather as a complementary approach to enhance overall health and well-being.The integration of TCM into modern healthcare systems offersa more comprehensive approach to patient care. By combiningthe best of both worlds, healthcare providers can offer patients a wider range of treatment options, leading to improved outcomes and greater satisfaction.In conclusion, the role of traditional Chinese medicine in modern healthcare is significant and growing. Its holistic approach and focus on prevention provide a valuable additionto the Western medical model. As research continues tovalidate the effectiveness of TCM practices, it is likelythat we will see an even greater integration of these ancient healing arts into the future of healthcare.。
关于水产牛羊的企业名称英语Aquatic Livestock Enterprises: A Comprehensive Guide to Naming.Introduction.The naming of a business is a crucial step in its establishment, as it serves as the foundation for brand recognition, reputation, and customer perception. This is especially true for enterprises involved in the production and distribution of aquatic livestock, such as fish and shellfish, as well as other livestock products derived from animals raised in aquatic environments. Choosing aneffective business name requires careful consideration of various factors, including the target audience, industry trends, and the overall image and mission of the enterprise.Key Considerations for Naming Aquatic Livestock Enterprises.Target Audience: Identify the specific group of customers that the business aims to serve. This includes considering their demographics, interests, and buying habits. For instance, a business targeting high-end restaurants might choose a name that conveys luxury and exclusivity.Industry Trends: Research the naming conventions and trends within the aquatic livestock industry. Analyze successful businesses in the sector to identify common patterns and avoid using names that are too similar or generic.Mission and Image: The business name should align with the overall mission, values, and image that the enterprise wishes to project. For example, a business focused on sustainable aquaculture practices might incorporate terms related to environmental consciousness into its name.Types of Business Names for Aquatic Livestock Enterprises.Descriptive Names: These names directly describe the products or services offered by the business. Examples include "Oceanic Aquaculture" or "Coastal Seafood Company."Evocative Names: These names evoke a particular emotion or feeling associated with the business. They often use imagery or metaphors to create a lasting impression. Examples include "Aquamarine Dreams" or "Tidal Treasures."Alliterative Names: These names use the repetition of the same sound at the beginning of multiple words. They are easy to remember and can create a sense of rhythm. Examples include "Blue Belle Seafood" or "Sea Symphony."Acronyms or Initials: These names use abbreviations or initials of the business's name. They can be effective for creating a unique and memorable identity. Examples include "AQS" (Aquatic Livestock Solutions) or "MFM" (Marine Food Market).Additional Tips for Naming Aquatic Livestock Enterprises.Keep it Simple: Avoid using long or complex names that are difficult to remember or pronounce.Consider SEO: Research relevant keywords and incorporate them into the business name to improvevisibility in online searches.Get Feedback: Seek feedback from potential customers, industry experts, and colleagues to gather diverse perspectives and refine the business name.Legal Considerations: Ensure that the chosen name does not infringe on any existing trademarks or business names. Conduct a thorough legal search to avoid potential legal disputes.Examples of Effective Business Names for Aquatic Livestock Enterprises.Neptune's Harvest: This name evokes the Roman god of the sea, creating an image of abundance and quality.Sea to Table: This name clearly conveys the business's mission of providing fresh seafood directly from the ocean to customers.AquaSphere: This name uses a combination of "aqua" (water) and "sphere" (globe) to suggest a global reach in aquatic livestock production.Blue Seas, Green Practices: This name incorporates environmental consciousness into its branding, appealing to consumers concerned about sustainability.Tidal Wave Aquaculture: This name uses alliteration to create a memorable and impactful impression, evoking the power of the ocean.Conclusion.Choosing the right business name for an aquatic livestock enterprise is a crucial step that can have a significant impact on its success. By carefully consideringthe target audience, industry trends, and the overall image and mission of the business, enterprises can develop effective names that resonate with customers, enhance brand recognition, and contribute to long-term growth and profitability.。
信贷全流程风险管理英语## Credit Full Process Risk Management.Definition:Credit full process risk management encompasses a comprehensive approach to managing and mitigating risks throughout the entire credit lifecycle, from origination to collection. It involves a systematic framework for assessing, monitoring, and controlling risks associated with credit approval, underwriting, account management, and recovery processes.Key Components:Credit Policy: Comprehensive guidelines for assessing creditworthiness and establishing credit limits.Credit Risk Assessment: Evaluation of borrowers' financial and non-financial information to determine theircreditworthiness and risk profile.Underwriting Process: Determination of the amount and terms of credit to be extended.Account Management: Monitoring account activity, adjusting credit limits, and managing delinquencies.Recovery Process: Efforts to collect outstanding debts, including collection strategies and workout agreements.Benefits of Credit Full Process Risk Management:Reduced Credit Losses: By proactively identifying and mitigating risks, lenders can significantly minimize credit losses.Improved Profitability: Efficient risk managementallows lenders to extend credit to more qualified borrowers, increasing loan volume and generating higher profits.Compliance and Reputation: A robust risk managementframework ensures compliance with regulatory requirements and protects the lender's reputation.Enhanced Customer Relationships: Transparent and fair risk management processes foster trust and build stronger relationships with borrowers.Data-Driven Decision-Making: Data analysis and modeling provide valuable insights for risk assessment and process optimization.Challenges in Credit Full Process Risk Management:Data Accuracy and Availability: Accessing complete and accurate data on borrowers can be challenging, especially for non-traditional lending.Subjectivity in Risk Assessment: Credit risk assessment involves subjective judgments, which can lead to biases or errors.Economic Conditions and Market Volatility: Externalfactors can significantly impact the credit risk landscape, making risk management dynamic and complex.Technology and Innovation: The rapid evolution of financial technology (fintech) requires continuous adaptation of risk management practices.Conclusion:Credit full process risk management is a crucial element for sound lending practices. By implementing a comprehensive and data-driven approach, lenders can proactively mitigate risks, improve profitability, and enhance customer relationships. As credit markets continue to evolve, it is essential for lenders to embrace innovative approaches and adapt their risk management strategies accordingly.## 信贷全流程风险管理。
分层教学法英语术语Title: Stratified Teaching Methodology: A Comprehensive Approach to English Language Instruction.In the realm of education, the stratified teaching methodology represents a forward-thinking approach that tailors instruction to meet the diverse needs of students. This innovative method recognizes that every learner possesses unique strengths, weaknesses, and learning rates, necessitating a flexible and personalized approach to teaching. This article delves into the stratified teaching method, its application in English language instruction, and the benefits it offers to both teachers and students.The Essence of Stratified Teaching.Stratified teaching, often referred to asdifferentiated instruction, is based on the premise that one size does not fit all in education. It involvesdividing students into different groups or "strata" basedon their academic abilities, learning styles, interests, or readiness levels. This stratification allows teachers to tailor their teaching strategies, materials, and assessments to better suit the needs of each group, thus promoting a more effective and engaging learning experience.Application in English Language Instruction.In the context of English language instruction,stratified teaching is particularly beneficial. English, being a language that encompasses multiple aspects such as reading, writing, speaking, and listening, requires a multifaceted approach to teaching. By stratifying students, teachers can focus on specific areas of need and address them more effectively.For example, students who struggle with reading comprehension can be grouped together and provided with additional support and materials that cater to their needs. Simultaneously, advanced students can be challenged with more complex texts and tasks that push their analytical and critical thinking skills. This tailored approach ensuresthat all students, regardless of their proficiency level, are engaged and challenged appropriately.Benefits of Stratified Teaching.Individualized Learning.At its core, stratified teaching promotesindividualized learning. By considering each student's unique strengths and weaknesses, teachers can designlessons that speak directly to their needs. This not only enhances learning but also fosters a sense of agency and ownership over one's own education.Enhanced Motivation.When students feel that their needs are being met and that they are making progress, their motivation levels increase. Stratified teaching ensures that students are working at a level that is challenging but not overwhelming, fostering a positive learning environment where they are more likely to thrive.Improved Teacher Efficiency.By grouping students based on their needs, teachers can allocate their resources more efficiently. Instead of spending time on one-size-fits-all lessons that may not resonate with all students, teachers can focus ondelivering targeted instruction that directly addresses the needs of each stratum.Fostering Collaboration and Peer Learning.Stratified teaching also encourages collaboration and peer learning. By grouping students with similar abilities and interests, teachers create opportunities for them to work together, share ideas, and learn from each other. This peer-to-peer learning can be incredibly powerful, often leading to deeper understanding and a more robust learning experience.Conclusion.In conclusion, the stratified teaching methodology represents a significant evolution in the field of education. Its emphasis on individualization, motivation, and efficiency makes it a highly effective approach to English language instruction. By tailoring lessons to meet the unique needs of each student, teachers can foster a more engaging, inclusive, and ultimately successful learning environment. As we continue to explore and refine this innovative method, it holds great promise for revolutionizing the way we teach and learn in the 21st century.。
液位高位英语High Liquid Level: A Comprehensive Approach to Monitoring and ManagementIn industrial and residential settings, the management of liquid levels is crucial for the safe and efficient operation of systems that involve water, chemicals, or other liquids. A high liquid level can be indicative of various conditions, ranging from normal operation to potential hazards. This essay will explore the importance of monitoring high liquid levels, the methods used to detect and manage them, and the implications of failing to do so.Firstly, monitoring high liquid levels is essential for preventing overflows, which can lead to equipment damage, environmental contamination, and safety risks. In water treatment plants, for instance, high levels in settling tanks can signal an impending overflow, which if not addressed, could result in untreated water being released into the environment.Various technologies are employed to detect and manage high liquid levels. Float switches are a common mechanical method, where a buoyant device activates a switch when the liquid level rises to a certain point. More advanced systems use pressure sensors or ultrasonic sensors that can provide continuous level monitoring without the need for physical contact with the liquid. These electronic methods offergreater precision and can be integrated into automatedcontrol systems for real-time response.The management of high liquid levels often involves a combination of physical barriers, such as overflow drains and containment berms, and operational adjustments, such as altering flow rates or activating pumps to transfer the excess liquid to a different location. In some cases, the liquid may need to be treated or processed before it can be safely discharged or reused.The consequences of failing to monitor and manage high liquid levels can be severe. In residential settings, a high water level in a tank or reservoir can lead to flooding, property damage, and even the spread of waterborne diseases. In industrial applications, it can result in equipment malfunction, environmental fines, and even legal liabilities.To mitigate these risks, it is vital to implement a robust liquid level monitoring and management strategy. This includes regular inspections of the liquid containment systems, maintenance of monitoring equipment, and the development of contingency plans for different high liquid level scenarios.In conclusion, the detection and management of highliquid levels are critical components of any liquid handling system. By employing a combination of monitoring technologies and management strategies, it is possible to maintain operational efficiency while minimizing the risk of overflows and their associated hazards.。
钥匙英语方法作文模板英文回答:The Key English Method (KEM) is a comprehensive approach to teaching and learning English as a foreign language. It was developed by Dr. James Asher in the 1970s and is based on the principles of natural language acquisition.The KEM has three main components:1. Comprehension-based instruction: This means that students learn English by listening to and reading comprehensible input, i.e., language that they can understand without too much effort.2. Delayed production: This means that students are not forced to produce language until they are ready. They are first given time to listen and read, and then they are gradually given opportunities to speak and write.3. Low-stress environment: This means that the classroom environment is relaxed and supportive. Students are not afraid to make mistakes, and they are encouraged to take risks.The KEM has been shown to be an effective method of teaching English as a foreign language. In studies, students who have learned English using the KEM have consistently outperformed students who have learned English using traditional methods.Here are some of the benefits of using the KEM:Students learn English in a more natural way.Students are more likely to retain what they have learned.Students are more confident and fluent in their use of English.Students are more motivated to learn English.If you are looking for an effective way to learnEnglish as a foreign language, the KEM is a great option.中文回答:钥匙英语法(KEM)是一种全面的英语外语教学和学习方法。
operational capability analysis Operational Capability Analysis: A Comprehensive Approach to Assessing Organizational PerformanceIntroduction:Operational capability analysis is a valuable tool that organizations can use to evaluate and enhance their performance. By systematically examining key operational capabilities, such as workforce skills, technology, and logistical capabilities, organizations can identify areas of strength and weakness, make informed decisions, and allocate resources effectively. This article will provide a step-by-step guide to conducting an operational capability analysis, highlighting the importance of each step and discussing potential challenges and benefits.Step 1: Establishing the Scope and ObjectivesBefore conducting an operational capability analysis, it is crucial to define its scope and objectives. This involves identifying the specific areas of the organization that will be evaluated and determining the goals of the analysis. For instance, an organizationmay choose to focus on its manufacturing capabilities or customer service operations. Clearly defining the scope and objectives will provide a framework for the analysis and enable meaningful results to be obtained.Step 2: Identifying Key Operational CapabilitiesThe next step in the analysis is to identify the key operational capabilities that will be assessed. These capabilities may vary depending on the nature of the organization and its industry. For example, a technology company may consider factors such as research and development capabilities, product innovation, and intellectual property management as critical capabilities. On the other hand, a logistics company might focus on transportation efficiency, warehouse management, and supply chain integration. It is essential to identify the capabilities that are most relevant to the organization's success.Step 3: Gathering Data and InformationAfter determining the key operational capabilities, the next step is to gather relevant data and information. This can be done througha variety of methods, such as surveys, interviews, and data analysis. Surveys can be used to gather input from employees and stakeholders, providing valuable insights into the organization's strengths and weaknesses. Interviews with key personnel can provide deeper insights into specific operational areas. Additionally, analyzing existing data and reports can help identify trends and patterns, providing a comprehensive view of the organization's capabilities.Step 4: Assessing Current PerformanceOnce the data has been collected, it is time to assess the organization's current performance in each operational capability identified. This can be done through a systematic evaluation, comparing the organization's performance against established benchmarks or industry standards. Key performance indicators (KPIs) can be used to measure performance in areas such as productivity, quality, cost-effectiveness, and customer satisfaction. By analyzing the gaps between the current performance and desired performance levels, organizations can identify areas for improvement.Step 5: Analyzing Strengths and WeaknessesIn this step, the focus shifts to identifying and analyzing the organization's strengths and weaknesses within each operational capability. This analysis should consider both internal factors, such as organizational structure and resources, and external factors, such as market dynamics and competition. By understanding the strengths that contribute to the organization's success and the weaknesses that hinder its performance, appropriate actions can be taken to build upon strengths and mitigate weaknesses.Step 6: Developing Action PlansBased on the analysis of strengths and weaknesses, organizations can develop action plans to improve their operational capabilities. These action plans should be specific, measurable, achievable, realistic, and time-bound (SMART). They should outline the steps, resources, and timelines required to address identified weaknesses and leverage strengths. Additionally, organizations should consider prioritizing areas for improvement based on their impact on overall performance and resource availability.Step 7: Implementation and MonitoringThe final step in the operational capability analysis process is the implementation and monitoring of the action plans. It is essential to assign responsibility for executing the action plans and establish mechanisms for monitoring progress. Regular tracking and reporting of key performance indicators will help ensure that the desired improvements are being achieved. Additionally, organizations should be prepared to adapt their plans as needed, considering changing internal and external factors.Challenges and Benefits:Conducting an operational capability analysis can be a complex and time-consuming process. Organizations may face challenges such as data collection difficulties, resistance to change, and resource constraints. Moreover, interpreting the analysis outcomes and translating them into actionable plans can also be challenging. However, the benefits of operational capability analysis far outweigh the challenges. By identifying strengths and weaknesses, organizations can make informed decisions, allocate resources effectively, and implement targeted improvements. This can lead toenhanced organizational performance, competitiveness, and adaptability in an ever-changing business environment.Conclusion:Operational capability analysis provides organizations with a comprehensive approach to assess their performance and identify areas for improvement. By following the step-by-step guide outlined in this article, organizations can systematically evaluate their operational capabilities, develop targeted action plans, and monitor progress. While challenges may arise during the analysis process, the benefits of enhanced performance and competitiveness make operational capability analysis an essential tool for any organization striving for success in today's dynamic business landscape.。
国家安全英语National Security。
National security refers to the protection of a nation's sovereignty, territorial integrity, and the safety of its citizens from internal and external threats. It encompasses various aspects such as military defense, intelligence gathering, law enforcement, and cybersecurity. In today's interconnected world, the concept of national security has evolved to include non-traditional threats such as terrorism, cyber attacks, and pandemics. Therefore, it is crucial for every country to have comprehensive strategies in place to safeguard its national security.One of the key components of national security is defense capability. A strong and modern military is essential for deterring potential aggressors and defending the country in the event of an armed conflict. This involves not only the development and acquisition of advanced weapons and technology but also the training and readiness of military personnel. Additionally, international cooperation and alliances play a significant role in enhancing a nation's defense capability, as it allows for the sharing of intelligence, resources, and expertise.In addition to military defense, intelligence gathering is another crucial aspect of national security. Intelligence agencies are responsible for collecting and analyzing information related to potential threats to the country. This includes monitoring the activities of hostile foreign powers, terrorist organizations, and other non-state actors. The information gathered by intelligence agencies is used to assess the intentions and capabilities of potential adversaries, thereby enabling policymakers to make informed decisions to protect the nation's interests.Furthermore, law enforcement agencies play a vital role in maintaining national security. They are responsible for upholding the rule of law, preventing and investigating criminal activities, and ensuring public safety. This includes combating organized crime, drug trafficking, human smuggling, and other illicit activities that pose a threat to the stability and security of the country. Additionally, border security and immigrationcontrol are important aspects of law enforcement that contribute to national security by preventing illegal entry and protecting the country from external threats.In the digital age, cybersecurity has become a critical component of national security. With the increasing reliance on information technology and the internet, countries are vulnerable to cyber attacks that can disrupt critical infrastructure, steal sensitive information, and undermine national security. Therefore, it is essential for governments to invest in robust cybersecurity measures to protect their networks, systems, and data from malicious actors. This includes developing advanced technologies, conducting regular security audits, and promoting cybersecurity awareness among the public and private sectors.In conclusion, national security is a multifaceted concept that requires a comprehensive and integrated approach to address the diverse challenges and threats facing modern societies. It is essential for governments to prioritize the development of defense capability, intelligence gathering, law enforcement, and cybersecurity to safeguard their sovereignty, protect their citizens, and preserve their way of life. By investing in these key areas, countries can effectively mitigate risks and ensure their national security in an increasingly complex and uncertain world.。
A Comprehensive Approach to Naming and Accessibility in Refactoring Java Programs Max Scha¨fer,Andreas Thies,Friedrich Steimann,and Frank TipAbstract—Automated tool support for refactoring is now widely available for mainstream programming languages such as Java.However,current refactoring tools are still quite fragile in practice and often fail to preserve program behavior or compilability.This is mainly because analyzing and transforming source code requires consideration of many language features that complicate program analysis,in particular intricate name lookup and access control rules.This paper introduces J L,a lookup-free,access control-free representation of Java programs.We present algorithms for translating Java programs into J L and vice versa,thereby making it possible to formulate refactorings entirely at the level of J L and to rely on the translations to take care of naming and accessibility issues.We demonstrate how complex refactorings become more robust and powerful when lifted to J L.Our approach has been implemented using the JastAddJ compiler framework,and evaluated by systematically performing two commonly used refactorings on an extensive suite of real-world Java applications.The evaluation shows that our tool correctly handles many cases where current refactoring tools fail to handle the complex rules for name binding and accessibility in Java.Index Terms—Restructuring,reverse engineering,and reengineering,object-oriented languages,JavaÇ1I NTRODUCTIONR EFACTORING is the process of restructuring a program by means of behavior-preserving source code transforma-tions,themselves called refactorings[1],[2].Over the past decade,automated tool support for refactoring has become available in popular IDEs such as Eclipse and VisualStudio. However,even state-of-the-art tools are still quite fragile, and often render refactored programs uncompilable or silently change program behavior.An important cause for this lack of robustness is the fact that refactoring tools analyze and transform programs at the source level,which is significantly more challenging than working on some convenient intermediate representa-tion,as compilers do.Source level programs contain many features such as nested classes,method overloading,and access modifiers that require great care when applying program transformations and that writers of compiler optimizations simply do not have to worry about.In the context of Java,two particularly vexing problems are name lookup and access control.Java’s rules for finding the declaration that a type or variable name refers to are quite intricate and context dependent.The combination of inheritance and lexical scoping,in particular,makes name lookup highly nonmodular so that changes to declarations can have repercussions throughout the program.Determin-ing whether a declaration is accessible at a given position in the program is a similarly knotty problem and,of course, the two problems are intertwined since accessibility can influence the result of name lookup.Naming and accessibility are omnipresent in refactoring: Any refactoring that introduces,moves,or deletes a declaration runs the risk of upsetting the program’s binding of names to declarations.Similarly,when a refactoring moves a reference to a declaration,great care has to be taken to ensure that it still binds to the same declaration after the move.Failure to do so may either lead to an uncompilable output program or,even worse,a program that still compiles but behaves differently due to changes in name resolution or overriding.Examples from both categories are easy to find even with state-of-the-art refactoring tools[3]such as the refactoring engines of Eclipse JDT[4]and IntelliJ IDEA[5].1 In this paper,we propose a comprehensive solution to these issues in the form of J L,a lookup-free and access control-free representation of Java programs.In J L,declara-tions are not identified by potentially ambiguous names but by unique labels,and are accessed by locked bindings that directly refer to a label without any lookup or access control rules.Unless explicitly rebound to a new declaration, locked bindings continue to refer to the same target declaration even if that declaration is renamed or moved; consequently,a transformation cannot accidentally change name bindings or introduce unbound names.We provide translations from Java to J L and vice versa, allowing refactorings to be formulated directly at the level of J L.This higher level of abstraction allows the imple-menter to concentrate on the essence of a refactoring,with the complexities of name binding and access control preservation being taken care of by the(refactoring.M.Scha¨fer is with the IBM T.J.Watson Research Center,19Skyline Drive, Hawthorne,NY10532.E-mail:mschaefer@.. A.Thies and F.Steimann are with the Fernuniversita¨t in Hagen, Universita¨tsstraße1,D-58097Hagen,Germany.E-mail:andreas.thies@fernuni-hagen.de,steimann@.. F.Tip is with the the David R.Cheriton School of Computer Science, University of Waterloo,200University Avenue West,Waterloo,ON N2L3G1,Canada.E-mail:ftip@uwaterloo.ca.Manuscript received29July2011;revised10Jan.2012;accepted21Jan. 2012;published online13Feb.2012.Recommended for acceptance by M.Robillard.For information on obtaining reprints of this article,please send e-mail to:tse@,and reference IEEECS Log Number TSE-2011-07-0228. Digital Object Identifier no.10.1109/TSE.2012.13.1.Throughout this paper,whenever we refer to Eclipse JDT we mean version3.6,and version10.5for IntelliJ IDEA,unless stated otherwise.0098-5589/12/$31.00ß2012IEEE Published by the IEEE Computer Societyindependent)translation to and from Java.Our translation from J L to Java is based on two key techniques:1.Reference construction.Unlocking the locked bind-ings of J L,i.e.,replacing them with normal Javanames,is easy if we have a reference constructionalgorithm that,given a declaration and a location inthe program,constructs a(possibly qualified)namewhich binds to this declaration.We show that suchan algorithm can be systematically derived from asuitable specification of name lookup.2.Accessibility constraints.Java’s access control rulescan be captured using constraint rules relating theaccessibilities of different declarations.A solution tothese constraints indicates how declared accessibil-ities have to be adjusted to ensure that the programadheres to the access control rules.J L and the translations to and from Java form the basis of the JRRT system[6],a prototype refactoring engine built on the JastAddJ Java compiler front end[7],which supports a growing number of popular refactorings[8].We evaluate this implementation both on the internal test suite of the Eclipse refactoring engine and on a large suite of real-world applications,demonstrating that it handles many situations where existing state-of-the-art tools just give up.In summary,our work makes the following main contributions:.We propose J L,a lookup-free and access control-free representation of Java programs and showhow existing refactorings become simpler andmore widely applicable when expressed on thatrepresentation..We show how an algorithm for constructing potentially qualified references that refer to a givendeclaration from a given program point can bederived from a suitable specification of Java namelookup..We demonstrate how the access control rules of Java can be captured by constraint rules that can beapplied to a program.These rules yield a set ofconstraints that are used to constrain possiblerefactoring transformations to avoid generatinguncompilable programs..We combine reference construction and accessibility constraints into an algorithm for translating from J Lto Java and report on an experimental evaluation ofa refactoring tool built on this approach.The remainder of this paper is organized as follows: Section2motivates the need for a systematic treatment of naming and accessibility by means of some examples. Section3surveys the name binding rules of Java and shows how to derive a reference construction algorithm from a suitable implementation of name lookup.Section4gives an overview of the access control rules of Java and demon-strates how they can be captured using constraint rules. These two techniques are then integrated in Section5to yield a translation from J L to Java.An implementation of our approach is presented in Section6and evaluated in Section7.Finally,Section8puts our work into the broader context of the literature,and Section9concludes.2M OTIVATING E XAMPLESWe start by giving some examples to show that naming and accessibility are pervasive problems that have to be dealt with by many refactorings.We then outline our proposed solution,which employs a novel lookup-free,access control-free representation of Java programs to address these problems in a refactoring-independent way.2.1Basic Naming ProblemsThe paradigmatic example of a refactoring that needs to deal with naming issues is the R ENAME refactoring,which changes the name of a declared entity(such as a class,field, or method)and consistently updates all references to use the new name while avoiding name capture.A simple example of this refactoring is shown in Fig.1. In the original program,shown on the left,the constructor of class A has a parameter newX that is used to initialize field x.Let us assume that the programmer wants to rename newX to have the same name as the field that it initializes.A refactoring tool should then produce the program on the right-hand side,where we have highlighted changes in gray:Both the parameter declaration and its single use have been updated to use the new name,and the reference to field x has been qualified with this to ensure that the reference still binds to the field after the renaming operation and is not captured by the renamed parameter.A plausible correctness criterion for R ENAME is that it should preserve the program’s binding structure:Names should bind to the same declaration in the refactored program as in the original program.Due to the complex lookup rules of Java and the delicate interplay between inheritance and lexical scoping this is not always easy to ensure.Section3will introduce a systematic way of constructing names that bind to a given declaration,making binding preservation easy to guarantee.The preservation of name bindings is also desirable in many other refactorings.For instance,the I NTRODUCE P ARAMETER refactoring turns a constant expression appear-ing inside a constructor or method body into an additional parameter and adjusts call sites accordingly.An example of this refactoring is shown in Fig.2,again with the original program on the left and the refactored program on the right. This refactoring has to deal with two naming issues:First,the introduced parameter should not lead to any name capture; this is avoided in the example by qualifying the reference to field x on line31as in the previous example.Second,the changed signature of the constructor leads to a change in overloading resolution for the new expression on line26: Whereas originally constructor A(long)was the most specific choice,the constructor A(int)would now be selected;to avoid this unwanted change in program Fig.1.A simple example of R ENAME.behavior,we have inserted an upcast to long on the argument,thus enforcing the same choice as before.Similar precautions have to be taken for any refactoring that introduces,moves,or deletes declarations[8].Even in cases where we do want name bindings to change,for instance with the E NCAPSULATE F IELD refactoring where field references are turned into calls to accessor methods, we generally want them to change in a controlled manner.This argues for a more high-level approach to name binding in which a refactoring does not directly manipulate raw Java names with their complex qualification and lookup rules,but instead specifies,for each name in the original program,which declaration it is supposed to bind to in the refactored program.A common naming frame-work then takes care of introducing qualifiers or upcasts where necessary to achieve the desired binding structure.Current industrial-strength refactoring tools fail to handle name bindings correctly in many cases.Eclipse correctly diagnoses the shadowing problem in Fig.1,but simply emits an error message and refuses to perform the renaming,while IDEA inserts the desired qualification. Both mishandle the example in Fig.2:Eclipse fails to recognize either of the naming issues,while IDEA notices the shadowing but fails to prevent the change in over-loading resolution.A notoriously difficult and,in current refactoring tool implementations,unsolved problem in binding preserva-tion arises from Java’s reflection API,which allows accessing classes,interfaces,fields,and methods by computed names.We do not tackle this issue here.There is current research on frameworks enabling sound static analysis in the presence of reflection[9]which,together with our approach,may help to enable reflection support for refactoring tools in the future.2.2Basic Accessibility ProblemsLike naming,accessibility is also handled poorly by current tools.For instance,consider the scenario of Fig.3,where the M OVE C LASS refactoring is applied to move class B from package a to package b.To remain accessible in the declaration on line45,B has to be made public as shown on line56.Eclipse fails to notice this problem and produces an uncompilable program;IDEA emits a warning,but does not attempt to fix the issue.While this problem is detected by the compiler,failure to adjust accessibility can be more detrimental in presence of dynamic binding.For instance,moving class B in Fig.4a to package b leaves the code compilable,but changes the meaning of the program because it changes the status of A.m from being overridden to not being overridden,so that calling m()on a receiver of static type A and dynamic type B will no longer dispatch to the implementation in B.In Eclipse,this change of meaning goes unnoticed;IDEA warns that class A contains a reference to class B,but this is not indicative of the problem.An accessibility-aware refactoring tool could instead suggest increasing the accessibility of A.m,and with it that of B.m(required by [10,Section8.4.8.1]),to protected,as shown in Fig.4b.2.3Naming and Accessibility Problems in E XTRACTI NTERFACEFor a somewhat more involved example of the subtle interactions of naming and accessibility with other language features and each other,let us consider the E XTRACT I NTERFACE refactoring.The purpose of this refactoring is to encourage loose coupling by creating a new interface I that declares some of the methods defined in a given class C and then updating declarations throughout the program to refer to I instead of C wherever possible[1],[11],[12].SCHA¨FER ET AL.:A COMPREHENSIVE APPROACH TO NAMING AND ACCESSIBILITY IN REFACTORING JAVA PROGRAMS1235 Fig.2.A simple example of I NTRODUCE P ARAMETER.Fig.3.A simple example of M OVE C LASS.Fig.4.An example of M OVE C LASS involving dynamic binding.While the essence of this refactoring is concerned with types,naming and accessibility issues also have to be handled.Consider,for instance,the example program of Fig.5a.For the purposes of this example,we will assume that the programmer wants to extract from class C an interface I that declares the method m.Fig.5b shows the program after applying the refactoring. The new interface I appears on lines117-119of Fig.5b,and, on line121,type C was made to implement this new interface.We now explain the other changes.Types.The goal is to use the new interface wherever possible.However,some declarations that refer to type C cannot be changed to I.For example,c2’s type on line131cannot be changed because then the call to n on line132would not be type-correct as interface I does not declare a method n.On the other hand,o’s type on line131and c1’s type on line130 can both be updated safely.Accessibility.Class C.B is declared private,meaning that it is not accessible outside class C.In particular,it is not accessible in the newly created interface I unless its accessibility is increased to at least package accessibility, as shown on line122.The newly created method I.m is implicitly public, hence method C.m,which overrides it,must be made public as well(line123).Names.References to nested classes such as C.B must be qualified outside of their declaring class.Hence,the signature of method I.m must use a qualified name(line118).A similar issue arises on line135where the typeB of field f has become ambiguous as a result of increasing the accessibility of class C.B.This is resolved by using the qualified type name J.B.Overloading.Changing c1’s type on line130to I renders the call to D’s constructor on line133ambiguous because neither constructor is now more specific than the other.This ambiguity is resolved by inserting an upcast2on line133.While this example is arguably quite contrived,it shows that a complex interplay exists between typing,access control,and naming(including overloading resolution)that refactoring tools must be aware of.Neither Eclipse nor IDEA can carry out the example refactoring since they require the extracted methods to be public already.If we change the example,making m public to begin with,both tools still fail to carry out some necessary adjustments, producing uncompilable output without a warning.1236IEEE TRANSACTIONS ON SOFTWARE ENGINEERING,VOL.38,NO.6,NOVEMBER/DECEMBER2012 Fig.5.Example application of the E XTRACT I NTERFACE refactoring.(a)The original program;(b)the program after the programmer has extracted from class C an interface I that declares method m(C.B).Fig.6.Example application of the P ULL U P M ETHOD refactoring:pulling up method C.foo(A)into B.2.This cast always succeeds at runtime and only serves to ensure that thecall is resolved to the correct declaration at compile time.2.4Naming and Accessibility Problems in P ULL U PM ETHODOf course,E XTRACT I NTERFACE is not the only refactoring that potentially faces such complications.Consider,for instance,the example program in Fig.6a,and assume the programmer wants to pull up method C.foo(A)into class B using the P ULL U P M ETHOD refactoring.We observe the following about the refactored code in Fig.6b.Accessibility.Method foo(A)calls C.baz,a private method that is not accessible in B.This issue is resolved by increasing baz’s accessibility to package on line158.Names.Accessing the static method baz outside of its declaring class requires explicit qualification of the method call on line154.Overloading.Moving method foo(A)into class B makes the call foo(null)on line163ambiguous because neither of the methods B.foo(A)and E.foo(String)is more specific than the other.This is resolved by adding an upcast on line163.In general,the P ULL U P M ETHOD refactoring also needs to preserve certain subtype relationships.For example, consider a scenario where a programmer attempts to pull up method foo(A)into class A.In this scenario,the refactoring cannot be applied because the type of the argument this in the method call baz(this)on line143. would become A,causing the call to become type-incorrect.In summary,P ULL U P M ETHOD requires careful analysis to respect subtyping,accessibility constraints,name,and overloading resolution.Again,the example exceeds the capabilities of Eclipse and IDEA,which reject it.2.5Our SolutionThe examples in this section suggest that naming and accessibility issues are pervasive in refactoring.More evidence of this can be found at the JRRT website[3], where we maintain a list of bugs found in refactorings as implemented by several industrial-strength refactoring engines,many of which concern naming and accessibility.However,the treatment of these issues is largely orthogonal to the purpose of a specific refactoring.Ideally, refactorings should work on a language where name bindings are always preserved except when they are explicitly rebound,and where access modifiers are auto-matically adjusted as necessary.This is the goal of the J L representation we introduce in this paper.In J L,normal Java names are abolished in favor of locked references of the form"l,where l is a label uniquely identifying a declaration,that directly bind to their declaration without regard to normal lookup and access control rules.Of course,J L is only to be used as an intermediate representation that simplifies the specification and imple-mentation of refactorings,so we need translations from Java to J L and back.The following two sections develop the technical machinery needed for these translations;Section5 will then show how to upgrade a Java-based refactoring specification to work on J L,revisiting some of the examples in this section.3R EFERENCE C ONSTRUCTIONIn this section,we consider the problem of how to construct a(possibly qualified)reference that binds to a given declaration from a given program point.More precisely,assume name lookup is given as a partial function,lookup:ProgramPointÂReference*Declaration;that determines the declaration d¼lookupðp;rÞa reference r at point p binds to,if any.We want to define a complementary reference construction function,access:ProgramPointÂDeclaration*Reference;that constructs a reference r¼accessðp;dÞunder which declaration d can be accessed from point p.The correctness of this function with respect to lookup is expressed by the condition8p;d:lookupðp;accessðp;dÞÞ¼d:ð1ÞIn other words,if function access produces a reference r under which to access declaration d from point p,then that reference really does bind to d at p:accessðp;ÀÞis a(partial) right inverse to lookupðp;ÀÞ.Given access,we can eliminate locked bindings from a program by simply replacing every locked binding"l occurring at some program point p with the reference accessðp;lÞ.If accessðp;lÞis undefined,indicating that an appropriate reference cannot be constructed,the refactoring is aborted.A trivial implementation of access that is undefined everywhere vacuously satisfies(1),but is not useful for eliminating locked bindings.We show in this section how a suitable specification of name lookup can be systematically inverted to yield a practical implementation of access.3.1Name Lookup in JavaThe Java Language Specification(JLS)introduces eight kinds of declared entities[10,Section6.1]:packages,class types(including enum types),interface types(including annotation types),type parameters,methods,fields,para-meters,and local variables.An entity is introduced by a declaration and can be referred to using a simple or qualified name.Like the JLS,we will use the term reference type to mean “class type,interface type or array type”and variable to mean“field,parameter,or local variable.”Every declared entity e has a scope[10,Section6.3], which encompasses all program points at which e can be referred to using a simple name,as long as it is visible.If, however,the scope of another entity e0of the same name is nested inside the scope of e,then e0is said to shadow e[10, Section6.3.1].Inside the scope of e0,entity e is no longer visible,and it is not possible to refer to e by its simple name;a qualified name has to be used instead.Shadowing is distinct from hiding[10,Section8.3]:A field declaration in a reference type T hides any declaration of a field with the same name in superclasses or super-interfaces of T,subject to accessibility restrictions detailed in Section 4.Similarly,static method declarations hideSCHA¨FER ET AL.:A COMPREHENSIVE APPROACH TO NAMING AND ACCESSIBILITY IN REFACTORING JAVA PROGRAMS1237methods with the same signature in superclasses or super-interfaces[10,Section8.4.8.2].Shadowing and hiding are both distinct from obscuring [10,Section 6.3.2]:In some syntactic contexts,it is not a priori clear whether a name refers to a package,a type,or a variable.In this case,variables are given priority over types,and types over packages.This means that there may be program points p where it is impossible to refer to a type or package e1by its simple name,even though it is visible, because p belongs to the scope of a variable or type e2of the same name;e2is then said to obscure e1at p.We illustrate these concepts by means of an example in Fig.7.This example program consists of a single compila-tion unit belonging to package p.The compilation unit declares five classes:Super,Outer,Inner,and two classes named A.In addition,it uses the primitive type int.The classes Super and Outer are top level classes, while Inner is a member class of Outer.Class Super declares an instance field f,a member class A, an instance method m,and a static field length;these are referred to as its local members.Likewise,Outer declares fields f and x,and two classes A and Inner.The latter class itself declares two fields f and y,as well as a method m.In addition to its local members,Inner also inherits the member class A from Super;thus,the scope of the class A declared on line169includes the bodies of both Super and Inner.Class Inner does not inherit field Super.f since the locally declared field Inner.f hides it,and it does not inherit method Super.m,since the locally declared method Inner.m overrides it.Also note that the field f of class Outer is shadowed,and hence not visible,inside the body of Inner,even though that body is part of its scope.Method m has a parameter f that shadows the field f of its host type Inner.The declarations of the local variables a1,a2,and a3in method m demonstrate different kinds of type names.A type name can be a simple name,as in the declaration of a1,which refers to class A from Inner,not its shadowed namesake from Outer.To refer to the latter type,we have to qualify it with the name of its enclosing type(line183),which may itself be qualified by the name of its package(line184).Lines186-194show examples of qualified variable and method references.Line186refers to variables x and y by their simple names,which is possible since they are visible. This would still work if y were declared in class Super or x in a superclass of Outer,but not if y were declared in an enclosing class of Super.Parameter f of m is also visible, and can thus be accessed by its simple name at line187,as indicated by the comment.The following lines show different forms of qualified field access expressions.Field f of class Inner,which is shadowed by the parameter f,can be referred to by qualifying with this(line188).The field f from Super, although hidden by the field f in Inner,is accessible through a qualification with super(line189).We can access the same two fields through qualification with Inner.this(line190)and Inner.super(line191), although such qualified this accesses are more usually employed to access shadowed fields of enclosing classes,as with the reference Outer.this.f(line192).Note that for fields,the access super.f is equivalent to((Super) this).f(line193),except that it has slightly more relaxed accessibility rules[10,Section6.6.2].Line194shows an example of obscuring:In the expression Super.length,name Super could either refer to a type or to a variable(though not to a package).Since this expression occurs within the scope of the local variable Super declared on line185,the latter interpretation is chosen;at runtime,this expression evaluates to the length of the array referenced by Super,which is0,and not to the value stored in the static field length of class Super.To refer to the latter field,we would have to use p.Super.length instead.One feature of Java name lookup that we have not illustrated in this example is method overloading[10, Section8.4.9]:At any given program point,several different candidate methods with the same name but different signatures may be in scope;to determine which method declaration an invocation refers to,the number and types of actual arguments are matched against the signatures of the candidate methods,and the closest match is chosen.If a unique closest match does not exist,the program is rejected with a compile-time error.The same process is also used to determine which constructor a class instance creation expression(i.e.,a new expression)or explicit constructor invocation[10,Section8.8.7.1]refers to.In the following,we will use the(nonstandard)term reference to cover package names,type names,field access expressions,expression names(i.e.,names referring to variables),method invocations,class instance creation expressions,and explicit constructor invocations.It will1238IEEE TRANSACTIONS ON SOFTWARE ENGINEERING,VOL.38,NO.6,NOVEMBER/DECEMBER2012 Fig.7.Example for name lookup in Java.。