with one click
e6-handle-missing-feature
// Replace unavailable target-platform features with equivalent or fallback implementations.
// Replace unavailable target-platform features with equivalent or fallback implementations.
[HINT] Download the complete skill directory including SKILL.md and all related files
| name | e6-handle-missing-feature |
| description | Replace unavailable target-platform features with equivalent or fallback implementations. |
description: Replace unavailable target-platform features with equivalent or fallback implementations. When to use: Source code uses a feature that doesn't exist in target framework
Purpose: Find equivalent functionality or implement alternative solution.
Clearly identify:
Check official documentation:
Search for:
Check version notes:
Choose appropriate approach:
A. Direct Equivalent Exists
B. No Direct Equivalent - Can Polyfill
C. No Equivalent - Architectural Change
D. No Equivalent - External Library
E. Feature Not Essential
Example: Layout Manager
Source (Java Swing):
panel.setLayout(new BorderLayout());
panel.add(component, BorderLayout.NORTH);
Target (Angular + Flexbox):
<div class="container">
<div class="north">{{ component }}</div>
</div>
.container {
display: flex;
flex-direction: column;
}
Map concepts:
Example: Observable Lifecycle
Source has feature X, target doesn't:
Create utility:
// utils/feature-polyfill.ts
export class FeatureHelper {
static doFeature(input: string): string {
// Implement the missing functionality
return input.toUpperCase(); // Example
}
}
Use in migrated code:
import { FeatureHelper } from '../utils/feature-polyfill';
const result = FeatureHelper.doFeature(value);
Example: Swing Event Listeners
Source (Java Swing):
button.addActionListener(e -> {
System.out.println("Clicked");
});
Target (Angular):
// Component template:
<button (click)="onButtonClick()">Click</button>
// Component class:
onButtonClick() {
console.log("Clicked");
}
Different pattern but same behavior.
Example: Advanced Data Grid
Source: Complex data table with built-in features
Target: Framework has basic table
Solution: Install grid library
npm install ag-grid-angular
import { AgGridModule } from 'ag-grid-angular';
@Component({
template: '<ag-grid-angular [rowData]="data"></ag-grid-angular>'
})
Example: Complex Animation
Source: Has sophisticated animation API
Target: Basic CSS transitions
Evaluate:
If non-essential:
// Use simple CSS transition instead of complex animation
// Add class to trigger CSS transition
element.classList.add('fade-in');
| Desktop Feature | Web Equivalent |
|---|---|
| File System Access | File API (with user permission) |
| Multi-window Apps | Browser tabs / Modal dialogs |
| System Tray | Browser notifications |
| Native Menus | HTML/CSS menus |
| Drag & Drop Files | HTML5 Drag & Drop API |
| Clipboard Access | Clipboard API |
| Print Dialog | window.print() + CSS print styles |
Java → TypeScript:
Thread.sleep() → await new Promise(r => setTimeout(r, ms))synchronized → Not needed (single-threaded JS) or use async locksFile I/O → Web: File API, Node: fs moduleReflection → TypeScript has limited reflection, use decoratorsSwing → Web Framework:
JFrame → Page/Component rootJPanel → <div> containerJButton → <button> elementJTextField → <input type="text">JLabel → <span> or <label>Layout Managers → CSS Flexbox/GridAfter applying solution:
Add note to migration-report.md:
## Feature Substitutions
### BorderLayout → CSS Flexbox
- **Original:** Java Swing's BorderLayout manager
- **Replacement:** CSS Flexbox with directional classes
- **Behavior:** Equivalent visual layout
- **Limitation:** None
### File System Access → File API
- **Original:** Direct file system read/write
- **Replacement:** Browser File API with user permission
- **Behavior:** User must select files via dialog
- **Limitation:** Can't access arbitrary files without user consent
Source:
Timer timer = new Timer(1000, e -> {
updateUI();
});
timer.start();
Target:
import { interval } from 'rxjs';
const subscription = interval(1000).subscribe(() => {
this.updateUI();
});
// Later: subscription.unsubscribe();
Or simpler:
setInterval(() => {
this.updateUI();
}, 1000);
Source (Spring):
@Autowired
private UserService userService;
Target (Angular):
constructor(private userService: UserService) {}
Same concept, different syntax.
Source (Java):
new Thread(() -> {
// Background work
String result = doWork();
SwingUtilities.invokeLater(() -> {
updateUI(result);
});
}).start();
Target (TypeScript/Angular):
// Use async/await with promises
async performWork() {
const result = await this.doWork(); // Async work
this.updateUI(result); // Update UI
}
// Or with RxJS:
this.http.get('/api/work').subscribe(result => {
this.updateUI(result);
});
Source: Has rich text editor built-in
Target: Framework has <textarea> only
Solution:
npm install @angular/cdk
npm install quill
npm install ngx-quill
import { QuillModule } from 'ngx-quill';
@NgModule({
imports: [QuillModule.forRoot()]
})
// In component:
<quill-editor [(ngModel)]="content"></quill-editor>
Source: Complex custom renderer
Target: Use standard components
Decision: Original renderer had 20 custom features, but app only uses 3.
Solution: Implement only the 3 features that are actually used, ignore the rest.
// Only implement what's needed
renderItem(item: Item) {
// Original had 20 rendering modes
// We only need 'text', 'image', 'link'
switch (item.type) {
case 'text': return this.renderText(item);
case 'image': return this.renderImage(item);
case 'link': return this.renderLink(item);
}
}